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

Commit f5f70b76 authored by Amit Mahajan's avatar Amit Mahajan Committed by Automerger Merge Worker
Browse files

Update subId on sim state READY. am: cec0675c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/15445919

Change-Id: I02eb734aa1da94543c60e8f10529a5e0f74f158f
parents 9cc5cb7e cec0675c
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -419,14 +419,9 @@ public class SubscriptionInfoUpdater extends Handler {
        UiccSlot uiccSlot = UiccController.getInstance().getUiccSlotForPhone(phoneId);
        String iccId = (uiccSlot != null) ? IccUtils.stripTrailingFs(uiccSlot.getIccId()) : null;
        if (!TextUtils.isEmpty(iccId)) {
            // Call updateSubscriptionInfoByIccId() only if was
            // not done earlier from SIM Locked event
            if (sIccId[phoneId] == null) {
            sIccId[phoneId] = iccId;

            updateSubscriptionInfoByIccId(phoneId, true /* updateEmbeddedSubs */);
        }
        }

        cardIds.add(getCardIdFromPhoneId(phoneId));
        updateEmbeddedSubscriptions(cardIds, (hasChanges) -> {
+0 −1
Original line number Diff line number Diff line
@@ -1163,7 +1163,6 @@ public class UiccController extends Handler {
        }

        if (changed && resp.refreshResult == IccRefreshResponse.REFRESH_RESULT_RESET) {
            uiccCard.getUiccProfile().onSimReset();
            // If there is any change on RESET, reset carrier config as well. From carrier config
            // perspective, this is treated the same as sim state unknown
            CarrierConfigManager configManager = (CarrierConfigManager)
+0 −8
Original line number Diff line number Diff line
@@ -523,14 +523,6 @@ public class UiccProfile extends IccCard {
        }
    }

    /**
     * This function is called on SIM_REFRESH of type RESET
     */
    public void onSimReset() {
        mLastReportedNumOfUiccApplications = 0;
        updateIccAvailability(true);
    }

    /**
     * ICC availability/state changed. Update corresponding fields and external state if needed.
     */
+0 −20
Original line number Diff line number Diff line
@@ -21,8 +21,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.doReturn;
@@ -636,22 +634,4 @@ public class UiccControllerTest extends TelephonyTest {
        assertEquals(mUiccControllerUT.convertToPublicCardId(knownEidFromApdu),
                mUiccControllerUT.getCardIdForDefaultEuicc());
    }

    @Test
    public void testSimRefresh() {
        mUiccControllerUT.mUiccSlots[0] = mMockSlot;
        doReturn(mMockCard).when(mMockSlot).getUiccCard();
        doReturn(mMockProfile).when(mMockCard).getUiccProfile();

        doReturn(true).when(mMockCard).resetAppWithAid(nullable(String.class), eq(true));
        IccRefreshResponse resp = new IccRefreshResponse();
        resp.refreshResult = IccRefreshResponse.REFRESH_RESULT_RESET;
        AsyncResult ar = new AsyncResult(null, resp, null);
        Message msg = Message.obtain(mUiccControllerUT, EVENT_SIM_REFRESH, ar);
        mUiccControllerUT.handleMessage(msg);
        processAllMessages();

        // verify that onSimReset() is called on refresh with RESET
        verify(mMockProfile).onSimReset();
    }
}