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

Commit 5d5bd6bd authored by Muralidhar Reddy's avatar Muralidhar Reddy
Browse files

Disabled sim is not enabled after sim hotswap

This issue is reproducible only on DSDS enabled device with both pSIMs. UiccCard/UiccPort object is created slighly late after receiving the slot status which is causing problem in getting iccId. Modified logic to use UiccSlot's getIccId API

Bug: 228416423
Test: Manual Test (Verified both esim and psim are latching to network. Also OEM partner verified on their device and confirmed) and atest FrameworksTelephonyTests
Change-Id: I1b8bcd1cb9482d8875243abe41a209d46fcc9421
parent e9d860df
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -4678,9 +4678,12 @@ public class GsmCdmaPhone extends Phone {
            return;
        }

        UiccPort port = mUiccController.getUiccPort(mPhoneId);
        String iccId = (port == null) ? null : port.getIccId();
        // Due to timing issue, sometimes UiccPort is coming null, so don't use UiccPort object
        // to retrieve the iccId here. Instead, depend on the UiccSlot API.
        String iccId = slot.getIccId(slot.getPortIndexFromPhoneId(mPhoneId));
        if (iccId == null) {
            loge("reapplyUiccAppsEnablementIfNeeded iccId is null, phoneId: " + mPhoneId
                    + " portIndex: " + slot.getPortIndexFromPhoneId(mPhoneId));
            return;
        }

+3 −7
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
    // Mocked classes
    private Handler mTestHandler;
    private UiccSlot mUiccSlot;
    private UiccPort mUiccPort;
    private CommandsInterface mMockCi;

    //mPhoneUnderTest
@@ -1253,8 +1252,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
        // Have IccId defined. But expected value and current value are the same. So no RIL command
        // should be sent.
        String iccId = "Fake iccId";
        doReturn(mUiccPort).when(mUiccController).getUiccPort(anyInt());
        doReturn(iccId).when(mUiccPort).getIccId();
        doReturn(iccId).when(mUiccSlot).getIccId(anyInt());
        Message.obtain(mPhoneUT, EVENT_ICC_CHANGED, null).sendToTarget();
        processAllMessages();
        verify(mSubscriptionController).getSubInfoForIccId(iccId);
@@ -1268,9 +1266,8 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
        // Set SIM to be present, with a fake iccId, and notify enablement being false.
        doReturn(mUiccSlot).when(mUiccController).getUiccSlotForPhone(anyInt());
        doReturn(IccCardStatus.CardState.CARDSTATE_PRESENT).when(mUiccSlot).getCardState();
        doReturn(mUiccPort).when(mUiccController).getUiccPort(anyInt());
        String iccId = "Fake iccId";
        doReturn(iccId).when(mUiccPort).getIccId();
        doReturn(iccId).when(mUiccSlot).getIccId(anyInt());
        Message.obtain(mPhoneUT, EVENT_UICC_APPS_ENABLEMENT_STATUS_CHANGED,
                new AsyncResult(null, false, null)).sendToTarget();
        processAllMessages();
@@ -1321,9 +1318,8 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
        // Set SIM to be present, with a fake iccId, and notify enablement being false.
        doReturn(mUiccSlot).when(mUiccController).getUiccSlotForPhone(anyInt());
        doReturn(IccCardStatus.CardState.CARDSTATE_PRESENT).when(mUiccSlot).getCardState();
        doReturn(mUiccPort).when(mUiccController).getUiccPort(anyInt());
        String iccId = "Fake iccId";
        doReturn(iccId).when(mUiccPort).getIccId();
        doReturn(iccId).when(mUiccSlot).getIccId(anyInt());
        Message.obtain(mPhoneUT, EVENT_UICC_APPS_ENABLEMENT_STATUS_CHANGED,
                new AsyncResult(null, false, null)).sendToTarget();
        processAllMessages();