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

Commit 33015068 authored by Malcolm Chen's avatar Malcolm Chen Committed by Automerger Merge Worker
Browse files

Apply mSubInfoListLock lock whenever touching mCacheActiveSubInfoList am: f08c38c4

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

Change-Id: If337ed74e1c321341622e93eda0e6e9adde0fb9a
parents a1430b02 f08c38c4
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;
    }