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

Commit 634481a5 authored by Collin Fijalkovich's avatar Collin Fijalkovich Committed by Automerger Merge Worker
Browse files

Merge changes from topic "rvc-telephony-caching" into rvc-dev am: 6ea08dd4

Change-Id: Ia4731435bbe674f828c0e2db7eb042d6bca468f3
parents 732e3037 6ea08dd4
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@ public class SubscriptionController extends ISub.Stub {
        public void clear() {
            mSlotIndexToSubIds.clear();
            invalidateDefaultSubIdCaches();
            invalidateSlotIndexCaches();
        }

        public Set<Entry<Integer, ArrayList<Integer>>> entrySet() {
@@ -183,11 +184,13 @@ public class SubscriptionController extends ISub.Stub {
        public void put(int slotIndex, ArrayList<Integer> value) {
            mSlotIndexToSubIds.put(slotIndex, value);
            invalidateDefaultSubIdCaches();
            invalidateSlotIndexCaches();
        }

        public void remove(int slotIndex) {
            mSlotIndexToSubIds.remove(slotIndex);
            invalidateDefaultSubIdCaches();
            invalidateSlotIndexCaches();
        }

        public int size() {
@@ -210,6 +213,7 @@ public class SubscriptionController extends ISub.Stub {
                        mSlotIndexToSubIds.remove(slotIndex);
                    }
                    invalidateDefaultSubIdCaches();
                    invalidateSlotIndexCaches();
                    return SUB_ID_FOUND;
                } else {
                    return SUB_ID_NOT_IN_SLOT;
@@ -227,6 +231,7 @@ public class SubscriptionController extends ISub.Stub {
                subIdList.add(value);
            }
            invalidateDefaultSubIdCaches();
            invalidateSlotIndexCaches();
        }

        public void clearSubIdList(int slotIndex) {
@@ -234,6 +239,7 @@ public class SubscriptionController extends ISub.Stub {
            if (subIdList != null) {
                subIdList.clear();
                invalidateDefaultSubIdCaches();
                invalidateSlotIndexCaches();
            }
        }
    }
@@ -255,12 +261,14 @@ public class SubscriptionController extends ISub.Stub {
    }

    private static WatchedSlotIndexToSubIds sSlotIndexToSubIds = new WatchedSlotIndexToSubIds();

    protected static WatchedInt sDefaultFallbackSubId =
            new WatchedInt(SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
        @Override
        public void set(int newValue) {
            super.set(newValue);
            invalidateDefaultSubIdCaches();
            invalidateSlotIndexCaches();
        }
    };

@@ -343,6 +351,7 @@ public class SubscriptionController extends ISub.Stub {
        invalidateDefaultDataSubIdCaches();
        invalidateDefaultSmsSubIdCaches();
        invalidateActiveDataSubIdCaches();
        invalidateSlotIndexCaches();

        if (DBG) logdl("[SubscriptionController] init by Context");
    }
@@ -4098,8 +4107,10 @@ public class SubscriptionController extends ISub.Stub {
            invalidateDefaultDataSubIdCaches();
            invalidateActiveDataSubIdCaches();
            invalidateDefaultSubIdCaches();
            invalidateSlotIndexCaches();
        } else if (name == Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION) {
            invalidateDefaultSubIdCaches();
            invalidateSlotIndexCaches();
        } else if (name == Settings.Global.MULTI_SIM_SMS_SUBSCRIPTION) {
            invalidateDefaultSmsSubIdCaches();
        }
@@ -4141,6 +4152,15 @@ public class SubscriptionController extends ISub.Stub {
        }
    }

    /**
     * @hide
     */
    protected static void invalidateSlotIndexCaches() {
        if (sCachingEnabled) {
            SubscriptionManager.invalidateSlotIndexCaches();
        }
    }

    /**
     * @hide
     */
+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.eq;

import android.app.AppOpsManager;
import android.app.PropertyInvalidatedCache;
import android.content.Context;
import android.os.Build;
import android.test.suitebuilder.annotation.SmallTest;
@@ -51,6 +52,7 @@ public class PhoneSubInfoControllerTest extends TelephonyTest {
    @Before
    public void setUp() throws Exception {
        super.setUp(getClass().getSimpleName());
        PropertyInvalidatedCache.disableForTestMode();
        /* mPhone -> PhoneId: 0 -> SubId:0
           mSecondPhone -> PhoneId:1 -> SubId: 1*/
        doReturn(0).when(mSubscriptionController).getPhoneId(eq(0));