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

Commit 25657717 authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by Gerrit Code Review
Browse files

Merge "Apply mSubInfoListLock lock whenever touching mCacheActiveSubInfoList"

parents e31de851 a8f6c8ee
Loading
Loading
Loading
Loading
+31 −23
Original line number Diff line number Diff line
@@ -577,6 +577,7 @@ public class SubscriptionController extends ISub.Stub {
     * @hide
     */
    public SubscriptionInfo getSubscriptionInfo(int subId) {
        synchronized (mSubInfoListLock) {
            // check cache for active subscriptions first, before querying db
            for (SubscriptionInfo subInfo : mCacheActiveSubInfoList) {
                if (subInfo.getSubscriptionId() == subId) {
@@ -589,6 +590,7 @@ public class SubscriptionController extends ISub.Stub {
                    return subInfo;
                }
            }
        }

        List<SubscriptionInfo> subInfoList = getSubInfo(
                SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID + "=" + subId, null);
@@ -1364,6 +1366,7 @@ public class SubscriptionController extends ISub.Stub {
        // validate the given info - does it exist in the active subscription list
        int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        int slotIndex = SubscriptionManager.INVALID_SIM_SLOT_INDEX;
        synchronized (mSubInfoListLock) {
            for (SubscriptionInfo info : mCacheActiveSubInfoList) {
                if ((info.getSubscriptionType() == subscriptionType)
                        && info.getIccId().equalsIgnoreCase(uniqueId)) {
@@ -1372,6 +1375,7 @@ public class SubscriptionController extends ISub.Stub {
                    break;
                }
            }
        }
        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
            if (DBG) {
                logd("Invalid subscription details: subscriptionType = " + subscriptionType
@@ -2608,13 +2612,15 @@ public class SubscriptionController extends ISub.Stub {
    }

    private boolean isSubscriptionVisible(int subId) {
        synchronized (mSubInfoListLock) {
            for (SubscriptionInfo info : mCacheOpportunisticSubInfoList) {
                if (info.getSubscriptionId() == subId) {
                // If group UUID is null, it's stand alone opportunistic profile. So it's visible.
                // otherwise, it's bundled opportunistic profile, and is not visible.
                    // If group UUID is null, it's stand alone opportunistic profile. So it's
                    // visible. Otherwise, it's bundled opportunistic profile, and is not visible.
                    return info.getGroupUuid() == null;
                }
            }
        }

        return true;
    }
@@ -3898,11 +3904,13 @@ public class SubscriptionController extends ISub.Stub {
    private boolean shouldDisableSubGroup(ParcelUuid groupUuid) {
        if (groupUuid == null) return false;

        synchronized (mSubInfoListLock) {
            for (SubscriptionInfo activeInfo : mCacheActiveSubInfoList) {
                if (!activeInfo.isOpportunistic() && groupUuid.equals(activeInfo.getGroupUuid())) {
                    return false;
                }
            }
        }

        return true;
    }