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

Commit 1f209d9d authored by Jack Yu's avatar Jack Yu Committed by android-build-merger
Browse files

Merge "Fixed a race when slot-to-sub mapping table is rebuilding"

am: e9a83470

Change-Id: Ic22fb7e3cea2960a11a5fdf43e491c9a23ad613a
parents 03ba9e23 e9a83470
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -740,10 +740,11 @@ public class SubscriptionController extends ISub.Stub {
                    do {
                        int subId = cursor.getInt(cursor.getColumnIndexOrThrow(
                                SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID));
                        // If sSlotIndexToSubId already has a valid subId for a slotIndex/phoneId,
                        // do not add another subId for same slotIndex/phoneId.
                        // If sSlotIndexToSubId already has the same subId for a slotIndex/phoneId,
                        // do not add it.
                        Integer currentSubId = sSlotIndexToSubId.get(slotIndex);
                        if (currentSubId == null
                                || currentSubId != subId
                                || !SubscriptionManager.isValidSubscriptionId(currentSubId)) {
                            // TODO While two subs active, if user deactivats first
                            // one, need to update the default subId with second one.
+7 −2
Original line number Diff line number Diff line
@@ -514,8 +514,6 @@ public class SubscriptionInfoUpdater extends Handler {
    synchronized private void updateSubscriptionInfoByIccId() {
        logd("updateSubscriptionInfoByIccId:+ Start");

        mSubscriptionManager.clearSubscriptionInfo();

        for (int i = 0; i < PROJECT_SIM_NUM; i++) {
            mInsertSimState[i] = SIM_NOT_CHANGE;
        }
@@ -529,6 +527,13 @@ public class SubscriptionInfoUpdater extends Handler {
        }
        logd("insertedSimCount = " + insertedSimCount);

        // We only clear the slot-to-sub map when one/some SIM was removed. Note this is a
        // workaround for some race conditions that the empty map was accessed while we are
        // rebuilding the map.
        if (SubscriptionController.getInstance().getActiveSubIdList().length > insertedSimCount) {
            SubscriptionController.getInstance().clearSubInfo();
        }

        int index = 0;
        for (int i = 0; i < PROJECT_SIM_NUM; i++) {
            if (mInsertSimState[i] == SIM_NOT_INSERT) {