summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Richard MacGregor <rmacgregor@google.com> 2024-11-27 19:22:08 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-11-27 19:22:08 +0000
commitdf04cbc109205779390282d4aabfe2f37acd400e (patch)
treecf8cbd6c81fe4602c8e794dc68a85ef9ad172331
parent996b6b00d73beb8491899b1d81b59a40e4e1991a (diff)
parent60d5f4c3f315e4e2d9be0fff7ba9824bdf1bcd2a (diff)
Merge "Add a check to ensure that preferred activities are not configured for profile group exclusive roles." into main
-rw-r--r--PermissionController/role-controller/java/com/android/role/controller/model/Role.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/PermissionController/role-controller/java/com/android/role/controller/model/Role.java b/PermissionController/role-controller/java/com/android/role/controller/model/Role.java
index e3269a146..0a04e2764 100644
--- a/PermissionController/role-controller/java/com/android/role/controller/model/Role.java
+++ b/PermissionController/role-controller/java/com/android/role/controller/model/Role.java
@@ -48,6 +48,7 @@ import androidx.annotation.VisibleForTesting;
import com.android.modules.utils.build.SdkLevel;
import com.android.role.controller.util.CollectionUtils;
import com.android.role.controller.util.PackageUtils;
+import com.android.role.controller.util.RoleFlags;
import com.android.role.controller.util.RoleManagerCompat;
import com.android.role.controller.util.UserUtils;
@@ -113,7 +114,8 @@ public class Role {
static {
sExclusivityValues.put(EXCLUSIVITY_NONE, true);
sExclusivityValues.put(EXCLUSIVITY_USER, true);
- sExclusivityValues.put(EXCLUSIVITY_PROFILE_GROUP, true);
+ sExclusivityValues.put(EXCLUSIVITY_PROFILE_GROUP,
+ RoleFlags.isProfileGroupExclusivityAvailable());
}
/**
@@ -347,6 +349,10 @@ public class Role {
throw new IllegalArgumentException(
"Role cannot be non-exclusive when showNone is true: " + exclusivity);
}
+ if (!mPreferredActivities.isEmpty() && exclusivity == EXCLUSIVITY_PROFILE_GROUP) {
+ throw new IllegalArgumentException(
+ "Role cannot have preferred activities when exclusivity is profileGroup");
+ }
return exclusivity;
}
}