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

Commit 85207297 authored by Nazanin Bakhshi's avatar Nazanin Bakhshi Committed by Automerger Merge Worker
Browse files

Merge "Use cached SubscriptionInfo from active subInfos, so that for each...

Merge "Use cached SubscriptionInfo from active subInfos, so that for each carrierPrivilege permission check we are not making a db query, therefore reducing race condition" am: 0506228d

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

Change-Id: I21bf587a8649208ac847a8dd265cb7623187a74e
parents b1f9243e 0506228d
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -572,6 +572,19 @@ public class SubscriptionController extends ISub.Stub {
     * @hide
     */
    public SubscriptionInfo getSubscriptionInfo(int subId) {
        // check cache for active subscriptions first, before querying db
        for (SubscriptionInfo subInfo : mCacheActiveSubInfoList) {
            if (subInfo.getSubscriptionId() == subId) {
                return subInfo;
            }
        }
        // check cache for opportunistic subscriptions too, before querying db
        for (SubscriptionInfo subInfo : mCacheOpportunisticSubInfoList) {
            if (subInfo.getSubscriptionId() == subId) {
                return subInfo;
            }
        }

        List<SubscriptionInfo> subInfoList = getSubInfo(
                SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID + "=" + subId, null);
        if (subInfoList == null || subInfoList.isEmpty()) return null;