Loading src/com/android/packageinstaller/role/model/AssistantRoleBehavior.java +6 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,12 @@ public class AssistantRoleBehavior implements RoleBehavior { context); } @Override public boolean isVisibleAsUser(@NonNull Role role, @NonNull UserHandle user, @NonNull Context context) { return VisibilityMixin.isVisible("config_showDefaultAssistant", context); } @Nullable @Override public Intent getManageIntentAsUser(@NonNull Role role, @NonNull UserHandle user, Loading src/com/android/packageinstaller/role/model/EmergencyRoleBehavior.java +6 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,12 @@ public class EmergencyRoleBehavior implements RoleBehavior { return fallbackPackageInfo != null ? fallbackPackageInfo.packageName : null; } @Override public boolean isVisibleAsUser(@NonNull Role role, @NonNull UserHandle user, @NonNull Context context) { return VisibilityMixin.isVisible("config_showDefaultEmergency", context); } @Nullable @Override public CharSequence getConfirmationMessage(@NonNull Role role, @NonNull String packageName, Loading src/com/android/packageinstaller/role/model/ExclusiveDefaultHolderMixin.java +7 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,13 @@ public class ExclusiveDefaultHolderMixin { Log.w(LOG_TAG, "Cannot find resource for default holder: " + resourceName); return null; } String packageName = resources.getString(resourceId); String packageName; try { packageName = resources.getString(resourceId); } catch (Resources.NotFoundException e) { Log.w(LOG_TAG, "Cannot get resource for default holder: " + resourceName, e); return null; } if (TextUtils.isEmpty(packageName)) { return null; } Loading src/com/android/packageinstaller/role/model/HomeRoleBehavior.java +6 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,12 @@ public class HomeRoleBehavior implements RoleBehavior { return packageName; } @Override public boolean isVisibleAsUser(@NonNull Role role, @NonNull UserHandle user, @NonNull Context context) { return VisibilityMixin.isVisible("config_showDefaultHome", context); } @Override public void prepareApplicationPreferenceAsUser(@NonNull Role role, @NonNull Preference preference, @NonNull ApplicationInfo applicationInfo, Loading src/com/android/packageinstaller/role/model/Role.java +15 −0 Original line number Diff line number Diff line Loading @@ -246,6 +246,21 @@ public class Role { return null; } /** * Check whether this role should be visible to user. * * @param user the user to check for * @param context the {@code Context} to retrieve system services * * @return whether this role should be visible to user */ public boolean isVisibleAsUser(@NonNull UserHandle user, @NonNull Context context) { if (mBehavior != null) { return mBehavior.isVisibleAsUser(this, user, context); } return true; } /** * Get the {@link Intent} to manage this role, or {@code null} to use the default UI. * Loading Loading
src/com/android/packageinstaller/role/model/AssistantRoleBehavior.java +6 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,12 @@ public class AssistantRoleBehavior implements RoleBehavior { context); } @Override public boolean isVisibleAsUser(@NonNull Role role, @NonNull UserHandle user, @NonNull Context context) { return VisibilityMixin.isVisible("config_showDefaultAssistant", context); } @Nullable @Override public Intent getManageIntentAsUser(@NonNull Role role, @NonNull UserHandle user, Loading
src/com/android/packageinstaller/role/model/EmergencyRoleBehavior.java +6 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,12 @@ public class EmergencyRoleBehavior implements RoleBehavior { return fallbackPackageInfo != null ? fallbackPackageInfo.packageName : null; } @Override public boolean isVisibleAsUser(@NonNull Role role, @NonNull UserHandle user, @NonNull Context context) { return VisibilityMixin.isVisible("config_showDefaultEmergency", context); } @Nullable @Override public CharSequence getConfirmationMessage(@NonNull Role role, @NonNull String packageName, Loading
src/com/android/packageinstaller/role/model/ExclusiveDefaultHolderMixin.java +7 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,13 @@ public class ExclusiveDefaultHolderMixin { Log.w(LOG_TAG, "Cannot find resource for default holder: " + resourceName); return null; } String packageName = resources.getString(resourceId); String packageName; try { packageName = resources.getString(resourceId); } catch (Resources.NotFoundException e) { Log.w(LOG_TAG, "Cannot get resource for default holder: " + resourceName, e); return null; } if (TextUtils.isEmpty(packageName)) { return null; } Loading
src/com/android/packageinstaller/role/model/HomeRoleBehavior.java +6 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,12 @@ public class HomeRoleBehavior implements RoleBehavior { return packageName; } @Override public boolean isVisibleAsUser(@NonNull Role role, @NonNull UserHandle user, @NonNull Context context) { return VisibilityMixin.isVisible("config_showDefaultHome", context); } @Override public void prepareApplicationPreferenceAsUser(@NonNull Role role, @NonNull Preference preference, @NonNull ApplicationInfo applicationInfo, Loading
src/com/android/packageinstaller/role/model/Role.java +15 −0 Original line number Diff line number Diff line Loading @@ -246,6 +246,21 @@ public class Role { return null; } /** * Check whether this role should be visible to user. * * @param user the user to check for * @param context the {@code Context} to retrieve system services * * @return whether this role should be visible to user */ public boolean isVisibleAsUser(@NonNull UserHandle user, @NonNull Context context) { if (mBehavior != null) { return mBehavior.isVisibleAsUser(this, user, context); } return true; } /** * Get the {@link Intent} to manage this role, or {@code null} to use the default UI. * Loading