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

Commit 28ab52a0 authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by Automerger Merge Worker
Browse files

Merge "Apply mSubInfoListLock lock whenever touching mCacheActiveSubInfoList"...

Merge "Apply mSubInfoListLock lock whenever touching mCacheActiveSubInfoList" am: 25657717 am: 325050b4

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1369537

Change-Id: I84ea046bd72a654f26b62cb0a8b49b16bd1e0872
parents 7861e06e 325050b4
Loading
Loading
Loading
Loading
+31 −23
Original line number Diff line number Diff line
@@ -740,6 +740,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) {
@@ -752,6 +753,7 @@ public class SubscriptionController extends ISub.Stub {
                    return subInfo;
                }
            }
        }

        List<SubscriptionInfo> subInfoList = getSubInfo(
                SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID + "=" + subId, null);
@@ -1531,6 +1533,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)) {
@@ -1539,6 +1542,7 @@ public class SubscriptionController extends ISub.Stub {
                    break;
                }
            }
        }
        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
            if (DBG) {
                logd("Invalid subscription details: subscriptionType = " + subscriptionType
@@ -2766,13 +2770,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;
    }
@@ -4130,11 +4136,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;
    }