Loading src/java/com/android/internal/telephony/MultiSimSettingController.java +1 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import static android.telephony.TelephonyManager.EXTRA_SIM_COMBINATION_WARNING_T import static android.telephony.TelephonyManager.EXTRA_SIM_COMBINATION_WARNING_TYPE_DUAL_CDMA; import static android.telephony.TelephonyManager.EXTRA_SIM_COMBINATION_WARNING_TYPE_NONE; import static android.telephony.TelephonyManager.EXTRA_SUBSCRIPTION_ID; import static android.telephony.TelephonyManager.MODEM_COUNT_SINGLE_MODEM; import android.annotation.IntDef; import android.annotation.NonNull; Loading Loading @@ -493,7 +492,7 @@ public class MultiSimSettingController extends Handler { // set the primary to be default SIM and return. if (mPrimarySubList.size() == 1 && (change != PRIMARY_SUB_REMOVED || ((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE)) .getActiveModemCount() == MODEM_COUNT_SINGLE_MODEM)) { .getActiveModemCount() == 1)) { int subId = mPrimarySubList.get(0); if (DBG) log("[updateDefaultValues] to only primary sub " + subId); mSubController.setDefaultDataSubId(subId); Loading tests/telephonytests/src/com/android/internal/telephony/CarrierServiceBindHelperTest.java +11 −14 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ package com.android.internal.telephony; import static android.telephony.TelephonyManager.MODEM_COUNT_DUAL_MODEM; import static android.telephony.TelephonyManager.MODEM_COUNT_SINGLE_MODEM; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.clearInvocations; Loading @@ -41,7 +38,7 @@ public class CarrierServiceBindHelperTest extends TelephonyTest { @Before public void setUp() throws Exception { super.setUp(getClass().getSimpleName()); doReturn(MODEM_COUNT_SINGLE_MODEM).when(mTelephonyManager).getActiveModemCount(); doReturn(1).when(mTelephonyManager).getActiveModemCount(); } @After Loading @@ -55,30 +52,30 @@ public class CarrierServiceBindHelperTest extends TelephonyTest { public void testMultiSimConfigChanged() throws Exception { clearInvocations(mPhoneConfigurationManager); mCarrierServiceBindHelper = new CarrierServiceBindHelper(mContext); assertEquals(MODEM_COUNT_SINGLE_MODEM, mCarrierServiceBindHelper.mBindings.size()); assertEquals(MODEM_COUNT_SINGLE_MODEM, mCarrierServiceBindHelper.mLastSimState.size()); assertEquals(1, mCarrierServiceBindHelper.mBindings.size()); assertEquals(1, mCarrierServiceBindHelper.mLastSimState.size()); assertNotNull(mCarrierServiceBindHelper.mBindings.get(0)); assertNotNull(mCarrierServiceBindHelper.mLastSimState.get(0)); // Verify registration of EVENT_MULTI_SIM_CONFIG_CHANGED. doReturn(MODEM_COUNT_DUAL_MODEM).when(mTelephonyManager).getActiveModemCount(); PhoneConfigurationManager.notifyMultiSimConfigChange(MODEM_COUNT_DUAL_MODEM); doReturn(2).when(mTelephonyManager).getActiveModemCount(); PhoneConfigurationManager.notifyMultiSimConfigChange(2); processAllMessages(); assertEquals(MODEM_COUNT_DUAL_MODEM, mCarrierServiceBindHelper.mBindings.size()); assertEquals(MODEM_COUNT_DUAL_MODEM, mCarrierServiceBindHelper.mLastSimState.size()); assertEquals(2, mCarrierServiceBindHelper.mBindings.size()); assertEquals(2, mCarrierServiceBindHelper.mLastSimState.size()); assertNotNull(mCarrierServiceBindHelper.mBindings.get(0)); assertNotNull(mCarrierServiceBindHelper.mBindings.get(1)); assertNotNull(mCarrierServiceBindHelper.mLastSimState.get(0)); assertNotNull(mCarrierServiceBindHelper.mLastSimState.get(1)); // Switch back to single SIM. doReturn(MODEM_COUNT_SINGLE_MODEM).when(mTelephonyManager).getActiveModemCount(); PhoneConfigurationManager.notifyMultiSimConfigChange(MODEM_COUNT_SINGLE_MODEM); doReturn(1).when(mTelephonyManager).getActiveModemCount(); PhoneConfigurationManager.notifyMultiSimConfigChange(1); processAllMessages(); assertEquals(MODEM_COUNT_SINGLE_MODEM, mCarrierServiceBindHelper.mBindings.size()); assertEquals(MODEM_COUNT_SINGLE_MODEM, mCarrierServiceBindHelper.mLastSimState.size()); assertEquals(1, mCarrierServiceBindHelper.mBindings.size()); assertEquals(1, mCarrierServiceBindHelper.mLastSimState.size()); assertNotNull(mCarrierServiceBindHelper.mBindings.get(0)); assertNotNull(mCarrierServiceBindHelper.mLastSimState.get(0)); } Loading tests/telephonytests/src/com/android/internal/telephony/PhoneConfigurationManagerTest.java +17 −19 Original line number Diff line number Diff line Loading @@ -18,8 +18,6 @@ package com.android.internal.telephony; import static android.telephony.TelephonyManager.ACTION_MULTI_SIM_CONFIG_CHANGED; import static android.telephony.TelephonyManager.EXTRA_ACTIVE_SIM_SUPPORTED_COUNT; import static android.telephony.TelephonyManager.MODEM_COUNT_DUAL_MODEM; import static android.telephony.TelephonyManager.MODEM_COUNT_SINGLE_MODEM; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; Loading Loading @@ -91,17 +89,17 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { @Test @SmallTest public void testGetPhoneCount() throws Exception { init(MODEM_COUNT_SINGLE_MODEM); doReturn(MODEM_COUNT_SINGLE_MODEM).when(mTelephonyManager).getActiveModemCount(); assertEquals(MODEM_COUNT_SINGLE_MODEM, mPcm.getPhoneCount()); doReturn(MODEM_COUNT_DUAL_MODEM).when(mTelephonyManager).getActiveModemCount(); assertEquals(MODEM_COUNT_DUAL_MODEM, mPcm.getPhoneCount()); init(1); doReturn(1).when(mTelephonyManager).getActiveModemCount(); assertEquals(1, mPcm.getPhoneCount()); doReturn(2).when(mTelephonyManager).getActiveModemCount(); assertEquals(2, mPcm.getPhoneCount()); } @Test @SmallTest public void testEnablePhone() throws Exception { init(MODEM_COUNT_SINGLE_MODEM); init(1); // Phone is null. No crash. mPcm.enablePhone(null, true, null); Loading @@ -113,7 +111,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { @Test @SmallTest public void testGetDsdsCapability() throws Exception { init(MODEM_COUNT_SINGLE_MODEM); init(1); assertEquals(PhoneCapability.DEFAULT_SSSS_CAPABILITY, mPcm.getStaticPhoneCapability()); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); Loading @@ -130,24 +128,24 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { @Test @SmallTest public void testSwitchMultiSimConfig_notDsdsCapable_shouldFail() throws Exception { init(MODEM_COUNT_SINGLE_MODEM); init(1); assertEquals(PhoneCapability.DEFAULT_SSSS_CAPABILITY, mPcm.getStaticPhoneCapability()); // Try switching to dual SIM. Shouldn't work as we haven't indicated DSDS is supported. mPcm.switchMultiSimConfig(MODEM_COUNT_DUAL_MODEM); mPcm.switchMultiSimConfig(2); verify(mMockRadioConfig, never()).setModemsConfig(anyInt(), any()); } @Test @SmallTest public void testSwitchMultiSimConfig_dsdsCapable_noRebootRequired() throws Exception { init(MODEM_COUNT_SINGLE_MODEM); init(1); // Register for multi SIM config change. mPcm.registerForMultiSimConfigChange(mHandler, EVENT_MULTI_SIM_CONFIG_CHANGED, null); verify(mHandler, never()).sendMessageAtTime(any(), anyLong()); // Try switching to dual SIM. Shouldn't work as we haven't indicated DSDS is supported. mPcm.switchMultiSimConfig(MODEM_COUNT_DUAL_MODEM); mPcm.switchMultiSimConfig(2); verify(mMockRadioConfig, never()).setModemsConfig(anyInt(), any()); // Send static capability back to indicate DSDS is supported. Loading @@ -156,9 +154,9 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { // Try to switch to DSDS. setRebootRequiredForConfigSwitch(false); mPcm.switchMultiSimConfig(MODEM_COUNT_DUAL_MODEM); mPcm.switchMultiSimConfig(2); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).setModemsConfig(eq(MODEM_COUNT_DUAL_MODEM), captor.capture()); verify(mMockRadioConfig).setModemsConfig(eq(2), captor.capture()); // Send message back to indicate switch success. Message message = captor.getValue(); Loading @@ -167,21 +165,21 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { processAllMessages(); // Verify set system property being called. verify(mMi).setMultiSimProperties(MODEM_COUNT_DUAL_MODEM); verify(mMi).notifyPhoneFactoryOnMultiSimConfigChanged(any(), eq(MODEM_COUNT_DUAL_MODEM)); verify(mMi).setMultiSimProperties(2); verify(mMi).notifyPhoneFactoryOnMultiSimConfigChanged(any(), eq(2)); // Capture and verify registration notification. verify(mHandler).sendMessageAtTime(captor.capture(), anyLong()); message = captor.getValue(); assertEquals(EVENT_MULTI_SIM_CONFIG_CHANGED, message.what); assertEquals(MODEM_COUNT_DUAL_MODEM, ((AsyncResult) message.obj).result); assertEquals(2, ((AsyncResult) message.obj).result); // Capture and verify broadcast. ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(mContext).sendBroadcast(intentCaptor.capture()); Intent intent = intentCaptor.getValue(); assertEquals(ACTION_MULTI_SIM_CONFIG_CHANGED, intent.getAction()); assertEquals(MODEM_COUNT_DUAL_MODEM, intent.getIntExtra( assertEquals(2, intent.getIntExtra( EXTRA_ACTIVE_SIM_SUPPORTED_COUNT, 0)); // Verify RIL notification. Loading tests/telephonytests/src/com/android/internal/telephony/PhoneSwitcherTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.internal.telephony; import static android.telephony.CarrierConfigManager.KEY_DATA_SWITCH_VALIDATION_TIMEOUT_LONG; import static android.telephony.TelephonyManager.MODEM_COUNT_DUAL_MODEM; import static android.telephony.TelephonyManager.SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION; import static android.telephony.TelephonyManager.SET_OPPORTUNISTIC_SUB_SUCCESS; import static android.telephony.TelephonyManager.SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED; Loading Loading @@ -910,8 +909,8 @@ public class PhoneSwitcherTest extends TelephonyTest { setSlotIndexToSubId(0, 1); setDefaultDataSubId(1); setNumPhones(MODEM_COUNT_DUAL_MODEM, MODEM_COUNT_DUAL_MODEM); AsyncResult result = new AsyncResult(null, MODEM_COUNT_DUAL_MODEM, null); setNumPhones(2, 2); AsyncResult result = new AsyncResult(null, 2, null); Message.obtain(mPhoneSwitcher, EVENT_MULTI_SIM_CONFIG_CHANGED, result).sendToTarget(); processAllMessages(); Loading tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.telephony.PhoneStateListener.LISTEN_PHONE_CAPABILITY_CHANG import static android.telephony.PhoneStateListener.LISTEN_RADIO_POWER_STATE_CHANGED; import static android.telephony.PhoneStateListener.LISTEN_SRVCC_STATE_CHANGED; import static android.telephony.TelephonyManager.ACTION_MULTI_SIM_CONFIG_CHANGED; import static android.telephony.TelephonyManager.MODEM_COUNT_DUAL_MODEM; import static android.telephony.TelephonyManager.RADIO_POWER_OFF; import static android.telephony.TelephonyManager.RADIO_POWER_ON; import static android.telephony.TelephonyManager.RADIO_POWER_UNAVAILABLE; Loading Loading @@ -272,14 +271,14 @@ public class TelephonyRegistryTest extends TelephonyTest { assertEquals(RADIO_POWER_UNAVAILABLE, mRadioPowerState); // Switch to DSDS and re-send RADIO_POWER_ON on phone 1. This time it should be notified. doReturn(MODEM_COUNT_DUAL_MODEM).when(mTelephonyManager).getActiveModemCount(); doReturn(2).when(mTelephonyManager).getActiveModemCount(); mContext.sendBroadcast(new Intent(ACTION_MULTI_SIM_CONFIG_CHANGED)); mTelephonyRegistry.notifyRadioPowerStateChanged(1, 1, RADIO_POWER_ON); processAllMessages(); assertEquals(RADIO_POWER_ON, mRadioPowerState); // Switch back to single SIM mode and re-send on phone 0. This time it should be notified. doReturn(MODEM_COUNT_DUAL_MODEM).when(mTelephonyManager).getActiveModemCount(); doReturn(2).when(mTelephonyManager).getActiveModemCount(); mContext.sendBroadcast(new Intent(ACTION_MULTI_SIM_CONFIG_CHANGED)); mTelephonyRegistry.notifyRadioPowerStateChanged(0, 1, RADIO_POWER_OFF); processAllMessages(); Loading Loading
src/java/com/android/internal/telephony/MultiSimSettingController.java +1 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import static android.telephony.TelephonyManager.EXTRA_SIM_COMBINATION_WARNING_T import static android.telephony.TelephonyManager.EXTRA_SIM_COMBINATION_WARNING_TYPE_DUAL_CDMA; import static android.telephony.TelephonyManager.EXTRA_SIM_COMBINATION_WARNING_TYPE_NONE; import static android.telephony.TelephonyManager.EXTRA_SUBSCRIPTION_ID; import static android.telephony.TelephonyManager.MODEM_COUNT_SINGLE_MODEM; import android.annotation.IntDef; import android.annotation.NonNull; Loading Loading @@ -493,7 +492,7 @@ public class MultiSimSettingController extends Handler { // set the primary to be default SIM and return. if (mPrimarySubList.size() == 1 && (change != PRIMARY_SUB_REMOVED || ((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE)) .getActiveModemCount() == MODEM_COUNT_SINGLE_MODEM)) { .getActiveModemCount() == 1)) { int subId = mPrimarySubList.get(0); if (DBG) log("[updateDefaultValues] to only primary sub " + subId); mSubController.setDefaultDataSubId(subId); Loading
tests/telephonytests/src/com/android/internal/telephony/CarrierServiceBindHelperTest.java +11 −14 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ package com.android.internal.telephony; import static android.telephony.TelephonyManager.MODEM_COUNT_DUAL_MODEM; import static android.telephony.TelephonyManager.MODEM_COUNT_SINGLE_MODEM; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.clearInvocations; Loading @@ -41,7 +38,7 @@ public class CarrierServiceBindHelperTest extends TelephonyTest { @Before public void setUp() throws Exception { super.setUp(getClass().getSimpleName()); doReturn(MODEM_COUNT_SINGLE_MODEM).when(mTelephonyManager).getActiveModemCount(); doReturn(1).when(mTelephonyManager).getActiveModemCount(); } @After Loading @@ -55,30 +52,30 @@ public class CarrierServiceBindHelperTest extends TelephonyTest { public void testMultiSimConfigChanged() throws Exception { clearInvocations(mPhoneConfigurationManager); mCarrierServiceBindHelper = new CarrierServiceBindHelper(mContext); assertEquals(MODEM_COUNT_SINGLE_MODEM, mCarrierServiceBindHelper.mBindings.size()); assertEquals(MODEM_COUNT_SINGLE_MODEM, mCarrierServiceBindHelper.mLastSimState.size()); assertEquals(1, mCarrierServiceBindHelper.mBindings.size()); assertEquals(1, mCarrierServiceBindHelper.mLastSimState.size()); assertNotNull(mCarrierServiceBindHelper.mBindings.get(0)); assertNotNull(mCarrierServiceBindHelper.mLastSimState.get(0)); // Verify registration of EVENT_MULTI_SIM_CONFIG_CHANGED. doReturn(MODEM_COUNT_DUAL_MODEM).when(mTelephonyManager).getActiveModemCount(); PhoneConfigurationManager.notifyMultiSimConfigChange(MODEM_COUNT_DUAL_MODEM); doReturn(2).when(mTelephonyManager).getActiveModemCount(); PhoneConfigurationManager.notifyMultiSimConfigChange(2); processAllMessages(); assertEquals(MODEM_COUNT_DUAL_MODEM, mCarrierServiceBindHelper.mBindings.size()); assertEquals(MODEM_COUNT_DUAL_MODEM, mCarrierServiceBindHelper.mLastSimState.size()); assertEquals(2, mCarrierServiceBindHelper.mBindings.size()); assertEquals(2, mCarrierServiceBindHelper.mLastSimState.size()); assertNotNull(mCarrierServiceBindHelper.mBindings.get(0)); assertNotNull(mCarrierServiceBindHelper.mBindings.get(1)); assertNotNull(mCarrierServiceBindHelper.mLastSimState.get(0)); assertNotNull(mCarrierServiceBindHelper.mLastSimState.get(1)); // Switch back to single SIM. doReturn(MODEM_COUNT_SINGLE_MODEM).when(mTelephonyManager).getActiveModemCount(); PhoneConfigurationManager.notifyMultiSimConfigChange(MODEM_COUNT_SINGLE_MODEM); doReturn(1).when(mTelephonyManager).getActiveModemCount(); PhoneConfigurationManager.notifyMultiSimConfigChange(1); processAllMessages(); assertEquals(MODEM_COUNT_SINGLE_MODEM, mCarrierServiceBindHelper.mBindings.size()); assertEquals(MODEM_COUNT_SINGLE_MODEM, mCarrierServiceBindHelper.mLastSimState.size()); assertEquals(1, mCarrierServiceBindHelper.mBindings.size()); assertEquals(1, mCarrierServiceBindHelper.mLastSimState.size()); assertNotNull(mCarrierServiceBindHelper.mBindings.get(0)); assertNotNull(mCarrierServiceBindHelper.mLastSimState.get(0)); } Loading
tests/telephonytests/src/com/android/internal/telephony/PhoneConfigurationManagerTest.java +17 −19 Original line number Diff line number Diff line Loading @@ -18,8 +18,6 @@ package com.android.internal.telephony; import static android.telephony.TelephonyManager.ACTION_MULTI_SIM_CONFIG_CHANGED; import static android.telephony.TelephonyManager.EXTRA_ACTIVE_SIM_SUPPORTED_COUNT; import static android.telephony.TelephonyManager.MODEM_COUNT_DUAL_MODEM; import static android.telephony.TelephonyManager.MODEM_COUNT_SINGLE_MODEM; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; Loading Loading @@ -91,17 +89,17 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { @Test @SmallTest public void testGetPhoneCount() throws Exception { init(MODEM_COUNT_SINGLE_MODEM); doReturn(MODEM_COUNT_SINGLE_MODEM).when(mTelephonyManager).getActiveModemCount(); assertEquals(MODEM_COUNT_SINGLE_MODEM, mPcm.getPhoneCount()); doReturn(MODEM_COUNT_DUAL_MODEM).when(mTelephonyManager).getActiveModemCount(); assertEquals(MODEM_COUNT_DUAL_MODEM, mPcm.getPhoneCount()); init(1); doReturn(1).when(mTelephonyManager).getActiveModemCount(); assertEquals(1, mPcm.getPhoneCount()); doReturn(2).when(mTelephonyManager).getActiveModemCount(); assertEquals(2, mPcm.getPhoneCount()); } @Test @SmallTest public void testEnablePhone() throws Exception { init(MODEM_COUNT_SINGLE_MODEM); init(1); // Phone is null. No crash. mPcm.enablePhone(null, true, null); Loading @@ -113,7 +111,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { @Test @SmallTest public void testGetDsdsCapability() throws Exception { init(MODEM_COUNT_SINGLE_MODEM); init(1); assertEquals(PhoneCapability.DEFAULT_SSSS_CAPABILITY, mPcm.getStaticPhoneCapability()); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); Loading @@ -130,24 +128,24 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { @Test @SmallTest public void testSwitchMultiSimConfig_notDsdsCapable_shouldFail() throws Exception { init(MODEM_COUNT_SINGLE_MODEM); init(1); assertEquals(PhoneCapability.DEFAULT_SSSS_CAPABILITY, mPcm.getStaticPhoneCapability()); // Try switching to dual SIM. Shouldn't work as we haven't indicated DSDS is supported. mPcm.switchMultiSimConfig(MODEM_COUNT_DUAL_MODEM); mPcm.switchMultiSimConfig(2); verify(mMockRadioConfig, never()).setModemsConfig(anyInt(), any()); } @Test @SmallTest public void testSwitchMultiSimConfig_dsdsCapable_noRebootRequired() throws Exception { init(MODEM_COUNT_SINGLE_MODEM); init(1); // Register for multi SIM config change. mPcm.registerForMultiSimConfigChange(mHandler, EVENT_MULTI_SIM_CONFIG_CHANGED, null); verify(mHandler, never()).sendMessageAtTime(any(), anyLong()); // Try switching to dual SIM. Shouldn't work as we haven't indicated DSDS is supported. mPcm.switchMultiSimConfig(MODEM_COUNT_DUAL_MODEM); mPcm.switchMultiSimConfig(2); verify(mMockRadioConfig, never()).setModemsConfig(anyInt(), any()); // Send static capability back to indicate DSDS is supported. Loading @@ -156,9 +154,9 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { // Try to switch to DSDS. setRebootRequiredForConfigSwitch(false); mPcm.switchMultiSimConfig(MODEM_COUNT_DUAL_MODEM); mPcm.switchMultiSimConfig(2); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).setModemsConfig(eq(MODEM_COUNT_DUAL_MODEM), captor.capture()); verify(mMockRadioConfig).setModemsConfig(eq(2), captor.capture()); // Send message back to indicate switch success. Message message = captor.getValue(); Loading @@ -167,21 +165,21 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { processAllMessages(); // Verify set system property being called. verify(mMi).setMultiSimProperties(MODEM_COUNT_DUAL_MODEM); verify(mMi).notifyPhoneFactoryOnMultiSimConfigChanged(any(), eq(MODEM_COUNT_DUAL_MODEM)); verify(mMi).setMultiSimProperties(2); verify(mMi).notifyPhoneFactoryOnMultiSimConfigChanged(any(), eq(2)); // Capture and verify registration notification. verify(mHandler).sendMessageAtTime(captor.capture(), anyLong()); message = captor.getValue(); assertEquals(EVENT_MULTI_SIM_CONFIG_CHANGED, message.what); assertEquals(MODEM_COUNT_DUAL_MODEM, ((AsyncResult) message.obj).result); assertEquals(2, ((AsyncResult) message.obj).result); // Capture and verify broadcast. ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(mContext).sendBroadcast(intentCaptor.capture()); Intent intent = intentCaptor.getValue(); assertEquals(ACTION_MULTI_SIM_CONFIG_CHANGED, intent.getAction()); assertEquals(MODEM_COUNT_DUAL_MODEM, intent.getIntExtra( assertEquals(2, intent.getIntExtra( EXTRA_ACTIVE_SIM_SUPPORTED_COUNT, 0)); // Verify RIL notification. Loading
tests/telephonytests/src/com/android/internal/telephony/PhoneSwitcherTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.internal.telephony; import static android.telephony.CarrierConfigManager.KEY_DATA_SWITCH_VALIDATION_TIMEOUT_LONG; import static android.telephony.TelephonyManager.MODEM_COUNT_DUAL_MODEM; import static android.telephony.TelephonyManager.SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION; import static android.telephony.TelephonyManager.SET_OPPORTUNISTIC_SUB_SUCCESS; import static android.telephony.TelephonyManager.SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED; Loading Loading @@ -910,8 +909,8 @@ public class PhoneSwitcherTest extends TelephonyTest { setSlotIndexToSubId(0, 1); setDefaultDataSubId(1); setNumPhones(MODEM_COUNT_DUAL_MODEM, MODEM_COUNT_DUAL_MODEM); AsyncResult result = new AsyncResult(null, MODEM_COUNT_DUAL_MODEM, null); setNumPhones(2, 2); AsyncResult result = new AsyncResult(null, 2, null); Message.obtain(mPhoneSwitcher, EVENT_MULTI_SIM_CONFIG_CHANGED, result).sendToTarget(); processAllMessages(); Loading
tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.telephony.PhoneStateListener.LISTEN_PHONE_CAPABILITY_CHANG import static android.telephony.PhoneStateListener.LISTEN_RADIO_POWER_STATE_CHANGED; import static android.telephony.PhoneStateListener.LISTEN_SRVCC_STATE_CHANGED; import static android.telephony.TelephonyManager.ACTION_MULTI_SIM_CONFIG_CHANGED; import static android.telephony.TelephonyManager.MODEM_COUNT_DUAL_MODEM; import static android.telephony.TelephonyManager.RADIO_POWER_OFF; import static android.telephony.TelephonyManager.RADIO_POWER_ON; import static android.telephony.TelephonyManager.RADIO_POWER_UNAVAILABLE; Loading Loading @@ -272,14 +271,14 @@ public class TelephonyRegistryTest extends TelephonyTest { assertEquals(RADIO_POWER_UNAVAILABLE, mRadioPowerState); // Switch to DSDS and re-send RADIO_POWER_ON on phone 1. This time it should be notified. doReturn(MODEM_COUNT_DUAL_MODEM).when(mTelephonyManager).getActiveModemCount(); doReturn(2).when(mTelephonyManager).getActiveModemCount(); mContext.sendBroadcast(new Intent(ACTION_MULTI_SIM_CONFIG_CHANGED)); mTelephonyRegistry.notifyRadioPowerStateChanged(1, 1, RADIO_POWER_ON); processAllMessages(); assertEquals(RADIO_POWER_ON, mRadioPowerState); // Switch back to single SIM mode and re-send on phone 0. This time it should be notified. doReturn(MODEM_COUNT_DUAL_MODEM).when(mTelephonyManager).getActiveModemCount(); doReturn(2).when(mTelephonyManager).getActiveModemCount(); mContext.sendBroadcast(new Intent(ACTION_MULTI_SIM_CONFIG_CHANGED)); mTelephonyRegistry.notifyRadioPowerStateChanged(0, 1, RADIO_POWER_OFF); processAllMessages(); Loading