Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 910cd7b2 authored by Hongming Jin's avatar Hongming Jin
Browse files

Migrate emergency default app to role manager.

Bug: 123293861
Test: atest DefaultEmergencyPickerTest
Change-Id: I7ca729fa457c23ba7a3e7a00f271a601cd124290
parent b1183642
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -130,6 +130,12 @@ public class LegacyRoleResolutionPolicy implements RoleManagerService.RoleHolder
                String packageName = componentName != null ? componentName.getPackageName() : null;
                return CollectionUtils.singletonOrEmpty(packageName);
            }
            case RoleManager.ROLE_EMERGENCY: {
                String defaultEmergencyApp = Settings.Secure.getStringForUser(
                        mContext.getContentResolver(),
                        Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION, userId);
                return CollectionUtils.singletonOrEmpty(defaultEmergencyApp);
            }
            default: {
                Slog.e(LOG_TAG, "Don't know how to find legacy role holders for " + roleName);
                return Collections.emptyList();
+1 −0
Original line number Diff line number Diff line
@@ -237,6 +237,7 @@ public class RoleManagerService extends SystemService implements RoleUserState.C
            migrateRoleIfNecessary(RoleManager.ROLE_SMS, userId);
            migrateRoleIfNecessary(RoleManager.ROLE_ASSISTANT, userId);
            migrateRoleIfNecessary(RoleManager.ROLE_DIALER, userId);
            migrateRoleIfNecessary(RoleManager.ROLE_EMERGENCY, userId);

            // Some vital packages state has changed since last role grant
            // Run grants again