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

Commit 8d566764 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add config_defaultRoleHolders for specifying default role holders."

parents e88ab05c 7876adb6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -197,6 +197,7 @@ package android {
  }
  public static final class R.array {
    field public static final int config_defaultRoleHolders = 17235974; // 0x1070006
    field public static final int config_keySystemUuidMapping = 17235973; // 0x1070005
  }
+8 −0
Original line number Diff line number Diff line
@@ -1892,6 +1892,8 @@
               cell broadcasting sms, and MMS. -->
    <bool name="config_sms_capable">true</bool>

    <!-- TODO: STOPSHIP(b/110557011): Remove this from framework and overlays as we use
         config_defaultRoleHolders now. -->
    <!-- Default SMS Application. This will be the default SMS application when
         the phone first boots. The user can then change the default app to one
         of their choosing.
@@ -1910,6 +1912,12 @@
         the behavior will be as though no app was named as an explicit default. -->
    <string name="default_browser" translatable="false"></string>

    <!-- Default role holders. This will be an array of roles and package names of their default
         holders, with each item in the format of "ROLE_NAME: PACKAGE_NAME_1, PACKAGE_NAME_2". -->
    <string-array name="config_defaultRoleHolders" translatable="false">
        <item>android.app.role.SMS: com.android.messaging</item>
    </string-array>

    <!-- Enable/disable default bluetooth profiles:
        HSP_AG, ObexObjectPush, Audio, NAP -->
    <bool name="config_bluetooth_default_profiles">true</bool>
+5 −0
Original line number Diff line number Diff line
@@ -2985,6 +2985,11 @@
        <public name="system_notification_accent_color" />
    </public-group>

    <public-group type="array" first-id="0x01070006">
      <!-- @hide @SystemApi -->
      <public name="config_defaultRoleHolders" />
    </public-group>

  <!-- ===============================================================
       DO NOT ADD UN-GROUPED ITEMS HERE

+2 −0
Original line number Diff line number Diff line
@@ -62,6 +62,8 @@ public class LegacyRoleResolutionPolicy implements RoleManagerService.RoleHolder
                        mContext.getContentResolver(),
                        Settings.Secure.SMS_DEFAULT_APPLICATION, userId);

                // TODO: STOPSHIP: Remove the following code once we remove default_sms_application
                // and use the new config_defaultRoleHolders.
                if (result == null) {
                    Collection<SmsApplication.SmsApplicationData> applications =
                            SmsApplication.getApplicationCollectionAsUser(mContext, userId);
+4 −1
Original line number Diff line number Diff line
@@ -229,9 +229,12 @@ public class RoleManagerService extends SystemService implements RoleUserState.C
        // Any role for which we have a record are already migrated
        RoleUserState userState = getOrCreateUserState(userId);
        if (!userState.isRoleAvailable(role)) {
            userState.addRoleName(role);
            List<String> roleHolders = mLegacyRoleResolver.getRoleHolders(role, userId);
            if (roleHolders.isEmpty()) {
                return;
            }
            Slog.i(LOG_TAG, "Migrating " + role + ", legacy holders: " + roleHolders);
            userState.addRoleName(role);
            int size = roleHolders.size();
            for (int i = 0; i < size; i++) {
                userState.addRoleHolder(role, roleHolders.get(i));