summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Omer Ozer <omerozer@google.com> 2024-01-19 22:10:36 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-01-19 22:10:36 +0000
commit7a125332edfeb65db2f0cfff451f0ed9ff4bc47f (patch)
treeefbd8e35d8b45dc437d2859be905d62c65070ee6
parent65bed7eb64f55fa9924b8144093f359a343f9af6 (diff)
parent645eda6c3ad5cdf3816871b9f6cb95fd18f7b3b1 (diff)
Merge "Add Wallet Role to supported types in role service and add a getter for the holder." into main
-rw-r--r--service/java/com/android/role/RoleService.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/service/java/com/android/role/RoleService.java b/service/java/com/android/role/RoleService.java
index 2524627eb..a2a6bab35 100644
--- a/service/java/com/android/role/RoleService.java
+++ b/service/java/com/android/role/RoleService.java
@@ -100,15 +100,22 @@ public class RoleService extends SystemService implements RoleUserState.Callback
private static final long GRANT_DEFAULT_ROLES_INTERVAL_MILLIS = 1000;
- private static final String[] DEFAULT_APPLICATION_ROLES = {
- RoleManager.ROLE_ASSISTANT,
- RoleManager.ROLE_BROWSER,
- RoleManager.ROLE_CALL_REDIRECTION,
- RoleManager.ROLE_CALL_SCREENING,
- RoleManager.ROLE_DIALER,
- RoleManager.ROLE_HOME,
- RoleManager.ROLE_SMS,
- };
+ private static final String[] DEFAULT_APPLICATION_ROLES;
+
+ static {
+ List<String> defaultApplicationRoles = new ArrayList<>();
+ defaultApplicationRoles.add(RoleManager.ROLE_ASSISTANT);
+ defaultApplicationRoles.add(RoleManager.ROLE_BROWSER);
+ defaultApplicationRoles.add(RoleManager.ROLE_CALL_REDIRECTION);
+ defaultApplicationRoles.add(RoleManager.ROLE_CALL_SCREENING);
+ defaultApplicationRoles.add(RoleManager.ROLE_DIALER);
+ defaultApplicationRoles.add(RoleManager.ROLE_HOME);
+ defaultApplicationRoles.add(RoleManager.ROLE_SMS);
+ if (SdkLevel.isAtLeastV()) {
+ defaultApplicationRoles.add(RoleManager.ROLE_WALLET);
+ }
+ DEFAULT_APPLICATION_ROLES = defaultApplicationRoles.toArray(new String[0]);
+ }
@NonNull
private final AppOpsManager mAppOpsManager;