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

Commit 1de85f5b authored by Jack Nudelman's avatar Jack Nudelman Committed by Android (Google) Code Review
Browse files

Merge "Migrate Sim-inserted restore flow to begin after carrier config update." into sc-dev

parents 5ac0d96d 5ea07410
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -1352,8 +1352,6 @@ public class SubscriptionController extends ISub.Stub {
                        setDisplayName = true;
                        Uri uri = insertEmptySubInfoRecord(uniqueId, slotIndex);
                        if (DBG) logdl("[addSubInfoRecord] New record created: " + uri);
                        SubscriptionManager subManager = SubscriptionManager.from(mContext);
                        subManager.restoreSimSpecificSettingsForIccIdFromBackup(uniqueId);
                    } else { // there are matching records in the database for the given ICC_ID
                        int subId = cursor.getInt(0);
                        int oldSimInfoId = cursor.getInt(1);
+12 −1
Original line number Diff line number Diff line
@@ -579,15 +579,26 @@ public class SubscriptionInfoUpdater extends Handler {
         *  2. ACTION_SIM_STATE_CHANGED/ACTION_SIM_CARD_STATE_CHANGED
         *  /ACTION_SIM_APPLICATION_STATE_CHANGED
         *  3. ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED
         *  4. ACTION_CARRIER_CONFIG_CHANGED
         *  4. restore sim-specific settings
         *  5. ACTION_CARRIER_CONFIG_CHANGED
         */
        broadcastSimStateChanged(phoneId, IccCardConstants.INTENT_VALUE_ICC_LOADED, null);
        broadcastSimCardStateChanged(phoneId, TelephonyManager.SIM_STATE_PRESENT);
        broadcastSimApplicationStateChanged(phoneId, TelephonyManager.SIM_STATE_LOADED);
        updateSubscriptionCarrierId(phoneId, IccCardConstants.INTENT_VALUE_ICC_LOADED);
        /* Sim-specific settings restore depends on knowing both the mccmnc and the carrierId of the
        sim which is why it must be done after #updateSubscriptionCarrierId(). It is done before
        carrier config update to avoid any race conditions with user settings that depend on
        carrier config*/
        restoreSimSpecificSettingsForPhone(phoneId);
        updateCarrierServices(phoneId, IccCardConstants.INTENT_VALUE_ICC_LOADED);
    }

    private void restoreSimSpecificSettingsForPhone(int phoneId) {
        SubscriptionManager subManager = SubscriptionManager.from(sContext);
        subManager.restoreSimSpecificSettingsForIccIdFromBackup(sIccId[phoneId]);
    }

    private void updateCarrierServices(int phoneId, String simState) {
        CarrierConfigManager configManager =
                (CarrierConfigManager) sContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);