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

Commit 903c2402 authored by Arun kumar Voddu's avatar Arun kumar Voddu Committed by Automerger Merge Worker
Browse files

Merge "Updating mDefaultFallbackSubId cache in multiple scenarios" am: 4c151649

parents f4872472 4c151649
Loading
Loading
Loading
Loading
+22 −1
Original line number Original line Diff line number Diff line
@@ -1495,7 +1495,9 @@ public class SubscriptionController extends ISub.Stub {
                            // Set the default sub if not set or if single sim device
                            // Set the default sub if not set or if single sim device
                            if (!isSubscriptionForRemoteSim(subscriptionType)) {
                            if (!isSubscriptionForRemoteSim(subscriptionType)) {
                                if (!SubscriptionManager.isValidSubscriptionId(defaultSubId)
                                if (!SubscriptionManager.isValidSubscriptionId(defaultSubId)
                                        || subIdCountMax == 1) {
                                        || subIdCountMax == 1
                                        || mDefaultFallbackSubId.get() ==
                                        SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
                                    logdl("setting default fallback subid to " + subId);
                                    logdl("setting default fallback subid to " + subId);
                                    setDefaultFallbackSubId(subId, subscriptionType);
                                    setDefaultFallbackSubId(subId, subscriptionType);
                                }
                                }
@@ -1714,7 +1716,26 @@ public class SubscriptionController extends ISub.Stub {
        // Refresh the Cache of Active Subscription Info List
        // Refresh the Cache of Active Subscription Info List
        refreshCachedActiveSubscriptionInfoList();
        refreshCachedActiveSubscriptionInfoList();


        boolean isFallBackRefreshRequired = false;
        if (mDefaultFallbackSubId.get() > SubscriptionManager.INVALID_SUBSCRIPTION_ID &&
                mSlotIndexToSubIds.getCopy(slotIndex) != null &&
                mSlotIndexToSubIds.getCopy(slotIndex).contains(mDefaultFallbackSubId.get())) {
            isFallBackRefreshRequired = true;
        }
        mSlotIndexToSubIds.remove(slotIndex);
        mSlotIndexToSubIds.remove(slotIndex);
        // set mDefaultFallbackSubId to invalid in case mSlotIndexToSubIds do not have any entries
        if (mSlotIndexToSubIds.size() ==0 ) {
            mDefaultFallbackSubId.set(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
        } else if (isFallBackRefreshRequired) {
            // set mDefaultFallbackSubId to valid subId from mSlotIndexToSubIds
            for (int index = 0; index < getActiveSubIdArrayList().size(); index ++) {
                int subId = getActiveSubIdArrayList().get(index);
                if (subId > SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
                    mDefaultFallbackSubId.set(subId);
                    break;
                }
            }
        }
    }
    }


    /**
    /**