Loading src/java/com/android/internal/telephony/SubscriptionController.java +1 −1 Original line number Diff line number Diff line Loading @@ -3376,7 +3376,7 @@ public class SubscriptionController extends ISub.Stub { * Helper function to create selection argument of a list of subId. * The result should be: "in (subId1, subId2, ...)". */ private String getSelectionForSubIdList(int[] subId) { public static String getSelectionForSubIdList(int[] subId) { StringBuilder selection = new StringBuilder(); selection.append(SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID); selection.append(" IN ("); Loading src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +9 −0 Original line number Diff line number Diff line Loading @@ -600,6 +600,15 @@ public class SubscriptionInfoUpdater extends Handler { logd("SIM" + (phoneId + 1) + " hot plug out, absentAndInactive=" + absentAndInactive); } sIccId[phoneId] = ICCID_STRING_FOR_NO_SIM; int[] subIds = SubscriptionController.getInstance().getSubId(phoneId); if (subIds != null && subIds.length > 0) { // When a SIM is unplugged, mark uicc applications enabled. This is to make sure when // user unplugs and re-inserts the SIM card, we re-enable it. ContentValues value = new ContentValues(1); value.put(SubscriptionManager.UICC_APPLICATIONS_ENABLED, true); sContext.getContentResolver().update(SubscriptionManager.CONTENT_URI, value, SubscriptionController.getSelectionForSubIdList(subIds), null); } updateSubscriptionInfoByIccId(phoneId, true /* updateEmbeddedSubs */); // Do not broadcast if the SIM is absent and inactive, because the logical phoneId here is // no longer correct Loading tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.internal.telephony; import static android.telephony.SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; Loading Loading @@ -190,6 +192,12 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_SUB_ID_1), eq(IccCardConstants.INTENT_VALUE_ICC_ABSENT)); verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged(); ArgumentCaptor<ContentValues> valueCapture = ArgumentCaptor.forClass(ContentValues.class); verify(mContentProvider).update(any(), valueCapture.capture(), eq(UNIQUE_KEY_SUBSCRIPTION_ID + " IN (" + FAKE_SUB_ID_1 + ")"), any()); boolean uiccApplicationsEnabled = valueCapture.getValue() .getAsBoolean(SubscriptionManager.UICC_APPLICATIONS_ENABLED); assertTrue(uiccApplicationsEnabled); } @Test Loading Loading
src/java/com/android/internal/telephony/SubscriptionController.java +1 −1 Original line number Diff line number Diff line Loading @@ -3376,7 +3376,7 @@ public class SubscriptionController extends ISub.Stub { * Helper function to create selection argument of a list of subId. * The result should be: "in (subId1, subId2, ...)". */ private String getSelectionForSubIdList(int[] subId) { public static String getSelectionForSubIdList(int[] subId) { StringBuilder selection = new StringBuilder(); selection.append(SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID); selection.append(" IN ("); Loading
src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +9 −0 Original line number Diff line number Diff line Loading @@ -600,6 +600,15 @@ public class SubscriptionInfoUpdater extends Handler { logd("SIM" + (phoneId + 1) + " hot plug out, absentAndInactive=" + absentAndInactive); } sIccId[phoneId] = ICCID_STRING_FOR_NO_SIM; int[] subIds = SubscriptionController.getInstance().getSubId(phoneId); if (subIds != null && subIds.length > 0) { // When a SIM is unplugged, mark uicc applications enabled. This is to make sure when // user unplugs and re-inserts the SIM card, we re-enable it. ContentValues value = new ContentValues(1); value.put(SubscriptionManager.UICC_APPLICATIONS_ENABLED, true); sContext.getContentResolver().update(SubscriptionManager.CONTENT_URI, value, SubscriptionController.getSelectionForSubIdList(subIds), null); } updateSubscriptionInfoByIccId(phoneId, true /* updateEmbeddedSubs */); // Do not broadcast if the SIM is absent and inactive, because the logical phoneId here is // no longer correct Loading
tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.internal.telephony; import static android.telephony.SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; Loading Loading @@ -190,6 +192,12 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_SUB_ID_1), eq(IccCardConstants.INTENT_VALUE_ICC_ABSENT)); verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged(); ArgumentCaptor<ContentValues> valueCapture = ArgumentCaptor.forClass(ContentValues.class); verify(mContentProvider).update(any(), valueCapture.capture(), eq(UNIQUE_KEY_SUBSCRIPTION_ID + " IN (" + FAKE_SUB_ID_1 + ")"), any()); boolean uiccApplicationsEnabled = valueCapture.getValue() .getAsBoolean(SubscriptionManager.UICC_APPLICATIONS_ENABLED); assertTrue(uiccApplicationsEnabled); } @Test Loading