Loading src/java/com/android/internal/telephony/GsmCdmaPhone.java +5 −2 Original line number Original line Diff line number Diff line Loading @@ -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; } } Loading tests/telephonytests/src/com/android/internal/telephony/GsmCdmaPhoneTest.java +3 −7 Original line number Original line Diff line number Diff line Loading @@ -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 Loading Loading @@ -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); Loading @@ -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(); Loading Loading @@ -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(); Loading Loading
src/java/com/android/internal/telephony/GsmCdmaPhone.java +5 −2 Original line number Original line Diff line number Diff line Loading @@ -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; } } Loading
tests/telephonytests/src/com/android/internal/telephony/GsmCdmaPhoneTest.java +3 −7 Original line number Original line Diff line number Diff line Loading @@ -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 Loading Loading @@ -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); Loading @@ -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(); Loading Loading @@ -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(); Loading