summaryrefslogtreecommitdiff
path: root/PermissionController/role-controller/java/com/android/role/controller/behavior/SystemShellRoleBehavior.java
diff options
context:
space:
mode:
Diffstat (limited to 'PermissionController/role-controller/java/com/android/role/controller/behavior/SystemShellRoleBehavior.java')
-rw-r--r--PermissionController/role-controller/java/com/android/role/controller/behavior/SystemShellRoleBehavior.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/PermissionController/role-controller/java/com/android/role/controller/behavior/SystemShellRoleBehavior.java b/PermissionController/role-controller/java/com/android/role/controller/behavior/SystemShellRoleBehavior.java
index c0cbe9c25..621955770 100644
--- a/PermissionController/role-controller/java/com/android/role/controller/behavior/SystemShellRoleBehavior.java
+++ b/PermissionController/role-controller/java/com/android/role/controller/behavior/SystemShellRoleBehavior.java
@@ -26,6 +26,7 @@ import androidx.annotation.Nullable;
import com.android.role.controller.model.Role;
import com.android.role.controller.model.RoleBehavior;
+import com.android.role.controller.util.UserUtils;
/**
* Class for behavior of the system shell role.
@@ -33,12 +34,13 @@ import com.android.role.controller.model.RoleBehavior;
public class SystemShellRoleBehavior implements RoleBehavior {
@Nullable
@Override
- public Boolean isPackageQualified(@NonNull Role role, @NonNull String packageName,
- @NonNull Context context) {
- PackageManager packageManager = context.getPackageManager();
+ public Boolean isPackageQualifiedAsUser(@NonNull Role role, @NonNull String packageName,
+ @NonNull UserHandle user, @NonNull Context context) {
+ Context userContext = UserUtils.getUserContext(context, user);
+ PackageManager userPackageManager = userContext.getPackageManager();
int uid;
try {
- uid = packageManager.getPackageUid(packageName, 0);
+ uid = userPackageManager.getPackageUid(packageName, 0);
} catch (PackageManager.NameNotFoundException e) {
return false;
}