Merge "Migrate emergency default app to role manager."

This commit is contained in:
Hongming Jin
2019-02-21 20:37:53 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 0 deletions

View File

@@ -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();

View File

@@ -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