summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/role/RoleService.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/service/java/com/android/role/RoleService.java b/service/java/com/android/role/RoleService.java
index e5d20ef9d..ac6703545 100644
--- a/service/java/com/android/role/RoleService.java
+++ b/service/java/com/android/role/RoleService.java
@@ -732,6 +732,9 @@ public class RoleService extends SystemService implements RoleUserState.Callback
@Override
@Nullable
public String getDefaultApplicationAsUser(@NonNull String roleName, @UserIdInt int userId) {
+ // The MANAGE_DEFAULT_APPLICATIONS permission is only available on U+
+ Preconditions.checkState(SdkLevel.isAtLeastU(),
+ "This API is only available on Android 34 and above");
UserUtils.enforceCrossUserPermission(userId, /* allowAll= */ false,
/* enforceForProfileGroup= */ false, "getDefaultApplicationAsUser",
getContext());
@@ -758,6 +761,9 @@ public class RoleService extends SystemService implements RoleUserState.Callback
public void setDefaultApplicationAsUser(@NonNull String roleName,
@Nullable String packageName, @RoleManager.ManageHoldersFlags int flags,
@UserIdInt int userId, @NonNull RemoteCallback callback) {
+ // The MANAGE_DEFAULT_APPLICATIONS permission is only available on U+
+ Preconditions.checkState(SdkLevel.isAtLeastU(),
+ "This API is only available on Android 34 and above");
boolean enforceForProfileGroup = isProfileGroupExclusiveRole(roleName, getContext());
UserUtils.enforceCrossUserPermission(userId, /* allowAll= */ false,
enforceForProfileGroup, "setDefaultApplicationAsUser", getContext());