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

Commit e9a83470 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

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

parents 5f7d47c2 9981a70d
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -739,10 +739,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
@@ -533,8 +533,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;
        }
@@ -548,6 +546,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) {