Loading src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +4 −2 Original line number Diff line number Diff line Loading @@ -457,8 +457,10 @@ public class SubscriptionInfoUpdater extends Handler { // At this phase, the subscription list is accessible. Treating NOT_READY // as equivalent to ABSENT, once the rest of the system can handle it. sIccId[phoneId] = ICCID_STRING_FOR_NO_SIM; updateSubscriptionInfoByIccId(phoneId, false /* updateEmbeddedSubs */); } else { sIccId[phoneId] = null; } updateSubscriptionInfoByIccId(phoneId, false /* updateEmbeddedSubs */); broadcastSimStateChanged(phoneId, IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null); Loading Loading @@ -718,7 +720,7 @@ public class SubscriptionInfoUpdater extends Handler { mSubscriptionController.clearSubInfoRecord(phoneId); // If SIM is not absent, insert new record or update existing record. if (!ICCID_STRING_FOR_NO_SIM.equals(sIccId[phoneId])) { if (!ICCID_STRING_FOR_NO_SIM.equals(sIccId[phoneId]) && sIccId[phoneId] != null) { logd("updateSubscriptionInfoByIccId: adding subscription info record: iccid: " + sIccId[phoneId] + ", phoneId:" + phoneId); mSubscriptionManager.addSubscriptionInfoRecord(sIccId[phoneId], phoneId); Loading tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java +12 −11 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { private static final String FAKE_ICCID_1 = "89012604200000000000"; private static final String FAKE_MCC_MNC_1 = "123456"; private static final String FAKE_MCC_MNC_2 = "456789"; private static final int FAKE_PHONE_ID_1 = 0; private SubscriptionInfoUpdater mUpdater; private IccRecords mIccRecord; Loading Loading @@ -239,17 +240,17 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { @SmallTest public void testSimNotReady() throws Exception { mUpdater.updateInternalIccState( IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null, FAKE_SUB_ID_1); IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null, FAKE_PHONE_ID_1); processAllMessages(); assertFalse(mUpdater.isSubInfoInitialized()); verify(mSubscriptionContent, never()).put(anyString(), any()); CarrierConfigManager mConfigManager = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); verify(mConfigManager, never()).updateConfigForPhoneId(eq(FAKE_SUB_ID_1), verify(mConfigManager, never()).updateConfigForPhoneId(eq(FAKE_PHONE_ID_1), eq(IccCardConstants.INTENT_VALUE_ICC_NOT_READY)); verify(mSubscriptionController, never()).clearSubInfo(); verify(mSubscriptionController, never()).notifySubscriptionInfoChanged(); verify(mSubscriptionController).clearSubInfoRecord(FAKE_PHONE_ID_1); verify(mSubscriptionController).notifySubscriptionInfoChanged(); } @Test Loading @@ -259,19 +260,19 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { doReturn(true).when(mIccCard).isEmptyProfile(); mUpdater.updateInternalIccState( IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null, FAKE_SUB_ID_1); IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null, FAKE_PHONE_ID_1); processAllMessages(); assertTrue(mUpdater.isSubInfoInitialized()); // Sub info should be cleared and change should be notified. verify(mSubscriptionController).clearSubInfoRecord(eq(FAKE_SUB_ID_1)); verify(mSubscriptionController).clearSubInfoRecord(eq(FAKE_PHONE_ID_1)); verify(mSubscriptionController).notifySubscriptionInfoChanged(); // No new sub should be added. verify(mSubscriptionManager, never()).addSubscriptionInfoRecord(any(), anyInt()); verify(mSubscriptionContent, never()).put(anyString(), any()); CarrierConfigManager mConfigManager = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_SUB_ID_1), verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_PHONE_ID_1), eq(IccCardConstants.INTENT_VALUE_ICC_NOT_READY)); } Loading @@ -286,24 +287,24 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { doReturn(false).when(mSubInfo).areUiccApplicationsEnabled(); mUpdater.updateInternalIccState( IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null, FAKE_SUB_ID_1); IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null, FAKE_PHONE_ID_1); processAllMessages(); assertTrue(mUpdater.isSubInfoInitialized()); // Sub info should be cleared and change should be notified. verify(mSubscriptionController).clearSubInfoRecord(eq(FAKE_SUB_ID_1)); verify(mSubscriptionController).clearSubInfoRecord(eq(FAKE_PHONE_ID_1)); verify(mSubscriptionController).notifySubscriptionInfoChanged(); // No new sub should be added. verify(mSubscriptionManager, never()).addSubscriptionInfoRecord(any(), anyInt()); verify(mSubscriptionContent, never()).put(anyString(), any()); CarrierConfigManager mConfigManager = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_SUB_ID_1), verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_PHONE_ID_1), eq(IccCardConstants.INTENT_VALUE_ICC_NOT_READY)); // When becomes ABSENT, UICC_APPLICATIONS_ENABLED should be reset to true. mUpdater.updateInternalIccState( IccCardConstants.INTENT_VALUE_ICC_ABSENT, null, FAKE_SUB_ID_1); IccCardConstants.INTENT_VALUE_ICC_ABSENT, null, FAKE_PHONE_ID_1); processAllMessages(); ArgumentCaptor<ContentValues> valueCapture = ArgumentCaptor.forClass(ContentValues.class); verify(mContentProvider).update(eq(SubscriptionManager.CONTENT_URI), valueCapture.capture(), Loading Loading
src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +4 −2 Original line number Diff line number Diff line Loading @@ -457,8 +457,10 @@ public class SubscriptionInfoUpdater extends Handler { // At this phase, the subscription list is accessible. Treating NOT_READY // as equivalent to ABSENT, once the rest of the system can handle it. sIccId[phoneId] = ICCID_STRING_FOR_NO_SIM; updateSubscriptionInfoByIccId(phoneId, false /* updateEmbeddedSubs */); } else { sIccId[phoneId] = null; } updateSubscriptionInfoByIccId(phoneId, false /* updateEmbeddedSubs */); broadcastSimStateChanged(phoneId, IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null); Loading Loading @@ -718,7 +720,7 @@ public class SubscriptionInfoUpdater extends Handler { mSubscriptionController.clearSubInfoRecord(phoneId); // If SIM is not absent, insert new record or update existing record. if (!ICCID_STRING_FOR_NO_SIM.equals(sIccId[phoneId])) { if (!ICCID_STRING_FOR_NO_SIM.equals(sIccId[phoneId]) && sIccId[phoneId] != null) { logd("updateSubscriptionInfoByIccId: adding subscription info record: iccid: " + sIccId[phoneId] + ", phoneId:" + phoneId); mSubscriptionManager.addSubscriptionInfoRecord(sIccId[phoneId], phoneId); Loading
tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java +12 −11 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { private static final String FAKE_ICCID_1 = "89012604200000000000"; private static final String FAKE_MCC_MNC_1 = "123456"; private static final String FAKE_MCC_MNC_2 = "456789"; private static final int FAKE_PHONE_ID_1 = 0; private SubscriptionInfoUpdater mUpdater; private IccRecords mIccRecord; Loading Loading @@ -239,17 +240,17 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { @SmallTest public void testSimNotReady() throws Exception { mUpdater.updateInternalIccState( IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null, FAKE_SUB_ID_1); IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null, FAKE_PHONE_ID_1); processAllMessages(); assertFalse(mUpdater.isSubInfoInitialized()); verify(mSubscriptionContent, never()).put(anyString(), any()); CarrierConfigManager mConfigManager = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); verify(mConfigManager, never()).updateConfigForPhoneId(eq(FAKE_SUB_ID_1), verify(mConfigManager, never()).updateConfigForPhoneId(eq(FAKE_PHONE_ID_1), eq(IccCardConstants.INTENT_VALUE_ICC_NOT_READY)); verify(mSubscriptionController, never()).clearSubInfo(); verify(mSubscriptionController, never()).notifySubscriptionInfoChanged(); verify(mSubscriptionController).clearSubInfoRecord(FAKE_PHONE_ID_1); verify(mSubscriptionController).notifySubscriptionInfoChanged(); } @Test Loading @@ -259,19 +260,19 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { doReturn(true).when(mIccCard).isEmptyProfile(); mUpdater.updateInternalIccState( IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null, FAKE_SUB_ID_1); IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null, FAKE_PHONE_ID_1); processAllMessages(); assertTrue(mUpdater.isSubInfoInitialized()); // Sub info should be cleared and change should be notified. verify(mSubscriptionController).clearSubInfoRecord(eq(FAKE_SUB_ID_1)); verify(mSubscriptionController).clearSubInfoRecord(eq(FAKE_PHONE_ID_1)); verify(mSubscriptionController).notifySubscriptionInfoChanged(); // No new sub should be added. verify(mSubscriptionManager, never()).addSubscriptionInfoRecord(any(), anyInt()); verify(mSubscriptionContent, never()).put(anyString(), any()); CarrierConfigManager mConfigManager = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_SUB_ID_1), verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_PHONE_ID_1), eq(IccCardConstants.INTENT_VALUE_ICC_NOT_READY)); } Loading @@ -286,24 +287,24 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { doReturn(false).when(mSubInfo).areUiccApplicationsEnabled(); mUpdater.updateInternalIccState( IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null, FAKE_SUB_ID_1); IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null, FAKE_PHONE_ID_1); processAllMessages(); assertTrue(mUpdater.isSubInfoInitialized()); // Sub info should be cleared and change should be notified. verify(mSubscriptionController).clearSubInfoRecord(eq(FAKE_SUB_ID_1)); verify(mSubscriptionController).clearSubInfoRecord(eq(FAKE_PHONE_ID_1)); verify(mSubscriptionController).notifySubscriptionInfoChanged(); // No new sub should be added. verify(mSubscriptionManager, never()).addSubscriptionInfoRecord(any(), anyInt()); verify(mSubscriptionContent, never()).put(anyString(), any()); CarrierConfigManager mConfigManager = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_SUB_ID_1), verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_PHONE_ID_1), eq(IccCardConstants.INTENT_VALUE_ICC_NOT_READY)); // When becomes ABSENT, UICC_APPLICATIONS_ENABLED should be reset to true. mUpdater.updateInternalIccState( IccCardConstants.INTENT_VALUE_ICC_ABSENT, null, FAKE_SUB_ID_1); IccCardConstants.INTENT_VALUE_ICC_ABSENT, null, FAKE_PHONE_ID_1); processAllMessages(); ArgumentCaptor<ContentValues> valueCapture = ArgumentCaptor.forClass(ContentValues.class); verify(mContentProvider).update(eq(SubscriptionManager.CONTENT_URI), valueCapture.capture(), Loading