Loading src/java/com/android/internal/telephony/SubscriptionController.java +20 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,7 @@ public class SubscriptionController extends ISub.Stub { public void clear() { mSlotIndexToSubIds.clear(); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } public Set<Entry<Integer, ArrayList<Integer>>> entrySet() { Loading @@ -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() { Loading @@ -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; Loading @@ -227,6 +231,7 @@ public class SubscriptionController extends ISub.Stub { subIdList.add(value); } invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } public void clearSubIdList(int slotIndex) { Loading @@ -234,6 +239,7 @@ public class SubscriptionController extends ISub.Stub { if (subIdList != null) { subIdList.clear(); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } } } Loading @@ -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(); } }; Loading Loading @@ -343,6 +351,7 @@ public class SubscriptionController extends ISub.Stub { invalidateDefaultDataSubIdCaches(); invalidateDefaultSmsSubIdCaches(); invalidateActiveDataSubIdCaches(); invalidateSlotIndexCaches(); if (DBG) logdl("[SubscriptionController] init by Context"); } Loading Loading @@ -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(); } Loading Loading @@ -4141,6 +4152,15 @@ public class SubscriptionController extends ISub.Stub { } } /** * @hide */ protected static void invalidateSlotIndexCaches() { if (sCachingEnabled) { SubscriptionManager.invalidateSlotIndexCaches(); } } /** * @hide */ Loading tests/telephonytests/src/com/android/internal/telephony/PhoneSubInfoControllerTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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)); Loading Loading
src/java/com/android/internal/telephony/SubscriptionController.java +20 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,7 @@ public class SubscriptionController extends ISub.Stub { public void clear() { mSlotIndexToSubIds.clear(); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } public Set<Entry<Integer, ArrayList<Integer>>> entrySet() { Loading @@ -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() { Loading @@ -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; Loading @@ -227,6 +231,7 @@ public class SubscriptionController extends ISub.Stub { subIdList.add(value); } invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } public void clearSubIdList(int slotIndex) { Loading @@ -234,6 +239,7 @@ public class SubscriptionController extends ISub.Stub { if (subIdList != null) { subIdList.clear(); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } } } Loading @@ -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(); } }; Loading Loading @@ -343,6 +351,7 @@ public class SubscriptionController extends ISub.Stub { invalidateDefaultDataSubIdCaches(); invalidateDefaultSmsSubIdCaches(); invalidateActiveDataSubIdCaches(); invalidateSlotIndexCaches(); if (DBG) logdl("[SubscriptionController] init by Context"); } Loading Loading @@ -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(); } Loading Loading @@ -4141,6 +4152,15 @@ public class SubscriptionController extends ISub.Stub { } } /** * @hide */ protected static void invalidateSlotIndexCaches() { if (sCachingEnabled) { SubscriptionManager.invalidateSlotIndexCaches(); } } /** * @hide */ Loading
tests/telephonytests/src/com/android/internal/telephony/PhoneSubInfoControllerTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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)); Loading