Loading src/java/com/android/internal/telephony/MultiSimSettingController.java +5 −14 Original line number Diff line number Diff line Loading @@ -420,23 +420,14 @@ public class MultiSimSettingController extends Handler { return; } // b/153860050 Occasionally we receive carrier config change broadcast without subId // being specified in it. So here we do additional check to make sur we don't miss the // subId. if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) { subId = SubscriptionManager.getSubscriptionId(phoneId); if (SubscriptionManager.isValidSubscriptionId(subId)) { CarrierConfigManager cm = mContext.getSystemService(CarrierConfigManager.class); if (cm != null && cm.getConfigForSubId(subId) != null) { loge("onCarrierConfigChanged with invalid subId while subId " + subId + " is active and its config is loaded"); } } } if (cm != null) { if (CarrierConfigManager.isConfigForIdentifiedCarrier(cm.getConfigForSubId(subId))) { mCarrierConfigLoadedSubIds[phoneId] = subId; reEvaluateAll(); } } } /** * Check whether carrier config loaded for all subs Loading tests/telephonytests/src/com/android/internal/telephony/MultiSimSettingControllerTest.java +14 −7 Original line number Diff line number Diff line Loading @@ -247,6 +247,10 @@ public class MultiSimSettingControllerTest extends TelephonyTest { return SubscriptionManager.INVALID_SUBSCRIPTION_ID; }).when(mPhoneMock2).getSubId(); PersistableBundle bundle = new PersistableBundle(); bundle.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true); doReturn(bundle).when(mCarrierConfigManager).getConfigForSubId(anyInt()); replaceInstance(PhoneFactory.class, "sPhones", null, mPhones); // Capture listener to emulate the carrier config change notification used later ArgumentCaptor<CarrierConfigManager.CarrierConfigChangeListener> listenerArgumentCaptor = Loading Loading @@ -885,6 +889,13 @@ public class MultiSimSettingControllerTest extends TelephonyTest { doReturn(true).when(mPhoneMock2).isUserDataEnabled(); mMultiSimSettingControllerUT.notifyAllSubscriptionLoaded(); processAllMessages(); PersistableBundle bundle = new PersistableBundle(); bundle.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true); doReturn(bundle).when(mCarrierConfigManager).getConfigForSubId(eq(1)); PersistableBundle bundle2 = new PersistableBundle(); doReturn(bundle).when(mCarrierConfigManager).getConfigForSubId(eq(2)); sendCarrierConfigChanged(0, 1); // Notify carrier config change on phone1 without specifying subId. sendCarrierConfigChanged(1, SubscriptionManager.INVALID_SUBSCRIPTION_ID); Loading @@ -893,13 +904,9 @@ public class MultiSimSettingControllerTest extends TelephonyTest { verify(mDataSettingsManagerMock2, never()).setDataEnabled( TelephonyManager.DATA_ENABLED_REASON_USER, false, PHONE_PACKAGE); // Still notify carrier config without specifying subId2, but this time subController // and CarrierConfigManager have subId 2 active and ready. doReturn(2).when(mSubscriptionManagerService).getSubId(1); CarrierConfigManager cm = (CarrierConfigManager) mContext.getSystemService( mContext.CARRIER_CONFIG_SERVICE); doReturn(new PersistableBundle()).when(cm).getConfigForSubId(2); sendCarrierConfigChanged(1, SubscriptionManager.INVALID_SUBSCRIPTION_ID); logd("Sending the correct phone id and sub id"); bundle2.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true); sendCarrierConfigChanged(1, 2); processAllMessages(); // This time user data should be disabled on phone1. verify(mDataSettingsManagerMock2).setDataEnabled( Loading Loading
src/java/com/android/internal/telephony/MultiSimSettingController.java +5 −14 Original line number Diff line number Diff line Loading @@ -420,23 +420,14 @@ public class MultiSimSettingController extends Handler { return; } // b/153860050 Occasionally we receive carrier config change broadcast without subId // being specified in it. So here we do additional check to make sur we don't miss the // subId. if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) { subId = SubscriptionManager.getSubscriptionId(phoneId); if (SubscriptionManager.isValidSubscriptionId(subId)) { CarrierConfigManager cm = mContext.getSystemService(CarrierConfigManager.class); if (cm != null && cm.getConfigForSubId(subId) != null) { loge("onCarrierConfigChanged with invalid subId while subId " + subId + " is active and its config is loaded"); } } } if (cm != null) { if (CarrierConfigManager.isConfigForIdentifiedCarrier(cm.getConfigForSubId(subId))) { mCarrierConfigLoadedSubIds[phoneId] = subId; reEvaluateAll(); } } } /** * Check whether carrier config loaded for all subs Loading
tests/telephonytests/src/com/android/internal/telephony/MultiSimSettingControllerTest.java +14 −7 Original line number Diff line number Diff line Loading @@ -247,6 +247,10 @@ public class MultiSimSettingControllerTest extends TelephonyTest { return SubscriptionManager.INVALID_SUBSCRIPTION_ID; }).when(mPhoneMock2).getSubId(); PersistableBundle bundle = new PersistableBundle(); bundle.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true); doReturn(bundle).when(mCarrierConfigManager).getConfigForSubId(anyInt()); replaceInstance(PhoneFactory.class, "sPhones", null, mPhones); // Capture listener to emulate the carrier config change notification used later ArgumentCaptor<CarrierConfigManager.CarrierConfigChangeListener> listenerArgumentCaptor = Loading Loading @@ -885,6 +889,13 @@ public class MultiSimSettingControllerTest extends TelephonyTest { doReturn(true).when(mPhoneMock2).isUserDataEnabled(); mMultiSimSettingControllerUT.notifyAllSubscriptionLoaded(); processAllMessages(); PersistableBundle bundle = new PersistableBundle(); bundle.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true); doReturn(bundle).when(mCarrierConfigManager).getConfigForSubId(eq(1)); PersistableBundle bundle2 = new PersistableBundle(); doReturn(bundle).when(mCarrierConfigManager).getConfigForSubId(eq(2)); sendCarrierConfigChanged(0, 1); // Notify carrier config change on phone1 without specifying subId. sendCarrierConfigChanged(1, SubscriptionManager.INVALID_SUBSCRIPTION_ID); Loading @@ -893,13 +904,9 @@ public class MultiSimSettingControllerTest extends TelephonyTest { verify(mDataSettingsManagerMock2, never()).setDataEnabled( TelephonyManager.DATA_ENABLED_REASON_USER, false, PHONE_PACKAGE); // Still notify carrier config without specifying subId2, but this time subController // and CarrierConfigManager have subId 2 active and ready. doReturn(2).when(mSubscriptionManagerService).getSubId(1); CarrierConfigManager cm = (CarrierConfigManager) mContext.getSystemService( mContext.CARRIER_CONFIG_SERVICE); doReturn(new PersistableBundle()).when(cm).getConfigForSubId(2); sendCarrierConfigChanged(1, SubscriptionManager.INVALID_SUBSCRIPTION_ID); logd("Sending the correct phone id and sub id"); bundle2.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true); sendCarrierConfigChanged(1, 2); processAllMessages(); // This time user data should be disabled on phone1. verify(mDataSettingsManagerMock2).setDataEnabled( Loading