Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e364ac48 authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by Android (Google) Code Review
Browse files

Merge "Set uicc applications enabled after a SIM is removed." into rvc-dev

parents 7455c0a8 e676f258
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 (");
+9 −0
Original line number Diff line number Diff line
@@ -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
+8 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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