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

Commit 9882dc97 authored by Muralidhar Reddy Mule's avatar Muralidhar Reddy Mule Committed by Android (Google) Code Review
Browse files

Merge "Disabled sim is not enabled after sim hotswap" into tm-dev

parents e5e1392e 5d5bd6bd
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -4678,9 +4678,12 @@ public class GsmCdmaPhone extends Phone {
            return;
            return;
        }
        }


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


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


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