Loading src/java/com/android/internal/telephony/uicc/UiccProfile.java +4 −6 Original line number Diff line number Diff line Loading @@ -879,10 +879,9 @@ public class UiccProfile extends Handler implements IccCard { } } if (VDBG) { log("areAllApplicationsReady: outside loop, return " + (mUiccApplications[0] != null)); log("areAllApplicationsReady: outside loop, return " + (mUiccApplication != null)); } // Returns false if there is no application in the UiccProfile. return mUiccApplications[0] != null; return mUiccApplication != null; } private boolean areAllRecordsLoaded() { Loading @@ -896,10 +895,9 @@ public class UiccProfile extends Handler implements IccCard { } } if (VDBG) { log("areAllRecordsLoaded: outside loop, return " + (mUiccApplications[0] != null)); log("areAllRecordsLoaded: outside loop, return " + (mUiccApplication != null)); } // Returns false if there is no application in the UiccProfile. return mUiccApplications[0] != null; return mUiccApplication != null; } private int checkIndexLocked(int index, AppType expectedAppType, AppType altExpectedAppType) { Loading tests/telephonytests/src/com/android/internal/telephony/uicc/UiccProfileTest.java +61 −4 Original line number Diff line number Diff line Loading @@ -126,8 +126,11 @@ public class UiccProfileTest extends TelephonyTest { @Before public void setUp() throws Exception { super.setUp(getClass().getSimpleName()); /* initially there are no application available */ mIccCardStatus.mApplications = new IccCardApplicationStatus[]{}; /* initially there are no application available, but the array should not be empty. */ IccCardApplicationStatus umtsApp = composeUiccApplicationStatus( IccCardApplicationStatus.AppType.APPTYPE_USIM, IccCardApplicationStatus.AppState.APPSTATE_UNKNOWN, "0xA2"); mIccCardStatus.mApplications = new IccCardApplicationStatus[]{umtsApp}; mIccCardStatus.mCdmaSubscriptionAppIndex = mIccCardStatus.mImsSubscriptionAppIndex = mIccCardStatus.mGsmUmtsSubscriptionAppIndex = -1; Loading @@ -154,13 +157,18 @@ public class UiccProfileTest extends TelephonyTest { @Test @SmallTest public void tesUiccProfileInfoSanity() { assertEquals(0, mUiccProfile.getNumApplications()); assertEquals(1, mUiccProfile.getNumApplications()); assertNull(mUiccProfile.getUniversalPinState()); assertNull(mUiccProfile.getOperatorBrandOverride()); for (IccCardApplicationStatus.AppType mAppType : IccCardApplicationStatus.AppType.values()) { if (mAppType == IccCardApplicationStatus.AppType.APPTYPE_USIM) { assertTrue(mUiccProfile.isApplicationOnIcc(mAppType)); } else { assertFalse(mUiccProfile.isApplicationOnIcc(mAppType)); } } } @Test Loading Loading @@ -347,4 +355,53 @@ public class UiccProfileTest extends TelephonyTest { // response for them right away. Ideally applications and records should be mocked. assertEquals(State.LOADED, mUiccProfile.getState()); } @Test @SmallTest public void testUpdateUiccProfileApplicationNoApplication() { mIccCardStatus.mApplications = new IccCardApplicationStatus[]{}; mIccCardStatus.mCdmaSubscriptionAppIndex = -1; mIccCardStatus.mImsSubscriptionAppIndex = -1; mIccCardStatus.mGsmUmtsSubscriptionAppIndex = -1; Message mProfileUpdate = mHandler.obtainMessage(UICCPROFILE_UPDATE_APPLICATION_EVENT); setReady(false); mProfileUpdate.sendToTarget(); waitUntilReady(); /* wait for the carrier privilege rules to be loaded */ waitForMs(50); assertEquals(0, mUiccProfile.getNumApplications()); mUiccProfile.sendMessage(mUiccProfile.obtainMessage(EVENT_APP_READY)); waitForMs(SCARY_SLEEP_MS); // state is loaded since there is no applications. assertEquals(State.NOT_READY, mUiccProfile.getState()); } @Test @SmallTest public void testUpdateUiccProfileApplicationNoSupportApplication() { IccCardApplicationStatus unknownApp = composeUiccApplicationStatus( IccCardApplicationStatus.AppType.APPTYPE_UNKNOWN, IccCardApplicationStatus.AppState.APPSTATE_UNKNOWN, ""); mIccCardStatus.mApplications = new IccCardApplicationStatus[]{unknownApp}; mIccCardStatus.mCdmaSubscriptionAppIndex = -1; mIccCardStatus.mImsSubscriptionAppIndex = -1; mIccCardStatus.mGsmUmtsSubscriptionAppIndex = -1; Message mProfileUpdate = mHandler.obtainMessage(UICCPROFILE_UPDATE_APPLICATION_EVENT); setReady(false); mProfileUpdate.sendToTarget(); waitUntilReady(); /* wait for the carrier privilege rules to be loaded */ waitForMs(50); assertEquals(1, mUiccProfile.getNumApplications()); mUiccProfile.sendMessage(mUiccProfile.obtainMessage(EVENT_APP_READY)); waitForMs(SCARY_SLEEP_MS); // state is loaded since there is no applications. assertEquals(State.NOT_READY, mUiccProfile.getState()); } } Loading
src/java/com/android/internal/telephony/uicc/UiccProfile.java +4 −6 Original line number Diff line number Diff line Loading @@ -879,10 +879,9 @@ public class UiccProfile extends Handler implements IccCard { } } if (VDBG) { log("areAllApplicationsReady: outside loop, return " + (mUiccApplications[0] != null)); log("areAllApplicationsReady: outside loop, return " + (mUiccApplication != null)); } // Returns false if there is no application in the UiccProfile. return mUiccApplications[0] != null; return mUiccApplication != null; } private boolean areAllRecordsLoaded() { Loading @@ -896,10 +895,9 @@ public class UiccProfile extends Handler implements IccCard { } } if (VDBG) { log("areAllRecordsLoaded: outside loop, return " + (mUiccApplications[0] != null)); log("areAllRecordsLoaded: outside loop, return " + (mUiccApplication != null)); } // Returns false if there is no application in the UiccProfile. return mUiccApplications[0] != null; return mUiccApplication != null; } private int checkIndexLocked(int index, AppType expectedAppType, AppType altExpectedAppType) { Loading
tests/telephonytests/src/com/android/internal/telephony/uicc/UiccProfileTest.java +61 −4 Original line number Diff line number Diff line Loading @@ -126,8 +126,11 @@ public class UiccProfileTest extends TelephonyTest { @Before public void setUp() throws Exception { super.setUp(getClass().getSimpleName()); /* initially there are no application available */ mIccCardStatus.mApplications = new IccCardApplicationStatus[]{}; /* initially there are no application available, but the array should not be empty. */ IccCardApplicationStatus umtsApp = composeUiccApplicationStatus( IccCardApplicationStatus.AppType.APPTYPE_USIM, IccCardApplicationStatus.AppState.APPSTATE_UNKNOWN, "0xA2"); mIccCardStatus.mApplications = new IccCardApplicationStatus[]{umtsApp}; mIccCardStatus.mCdmaSubscriptionAppIndex = mIccCardStatus.mImsSubscriptionAppIndex = mIccCardStatus.mGsmUmtsSubscriptionAppIndex = -1; Loading @@ -154,13 +157,18 @@ public class UiccProfileTest extends TelephonyTest { @Test @SmallTest public void tesUiccProfileInfoSanity() { assertEquals(0, mUiccProfile.getNumApplications()); assertEquals(1, mUiccProfile.getNumApplications()); assertNull(mUiccProfile.getUniversalPinState()); assertNull(mUiccProfile.getOperatorBrandOverride()); for (IccCardApplicationStatus.AppType mAppType : IccCardApplicationStatus.AppType.values()) { if (mAppType == IccCardApplicationStatus.AppType.APPTYPE_USIM) { assertTrue(mUiccProfile.isApplicationOnIcc(mAppType)); } else { assertFalse(mUiccProfile.isApplicationOnIcc(mAppType)); } } } @Test Loading Loading @@ -347,4 +355,53 @@ public class UiccProfileTest extends TelephonyTest { // response for them right away. Ideally applications and records should be mocked. assertEquals(State.LOADED, mUiccProfile.getState()); } @Test @SmallTest public void testUpdateUiccProfileApplicationNoApplication() { mIccCardStatus.mApplications = new IccCardApplicationStatus[]{}; mIccCardStatus.mCdmaSubscriptionAppIndex = -1; mIccCardStatus.mImsSubscriptionAppIndex = -1; mIccCardStatus.mGsmUmtsSubscriptionAppIndex = -1; Message mProfileUpdate = mHandler.obtainMessage(UICCPROFILE_UPDATE_APPLICATION_EVENT); setReady(false); mProfileUpdate.sendToTarget(); waitUntilReady(); /* wait for the carrier privilege rules to be loaded */ waitForMs(50); assertEquals(0, mUiccProfile.getNumApplications()); mUiccProfile.sendMessage(mUiccProfile.obtainMessage(EVENT_APP_READY)); waitForMs(SCARY_SLEEP_MS); // state is loaded since there is no applications. assertEquals(State.NOT_READY, mUiccProfile.getState()); } @Test @SmallTest public void testUpdateUiccProfileApplicationNoSupportApplication() { IccCardApplicationStatus unknownApp = composeUiccApplicationStatus( IccCardApplicationStatus.AppType.APPTYPE_UNKNOWN, IccCardApplicationStatus.AppState.APPSTATE_UNKNOWN, ""); mIccCardStatus.mApplications = new IccCardApplicationStatus[]{unknownApp}; mIccCardStatus.mCdmaSubscriptionAppIndex = -1; mIccCardStatus.mImsSubscriptionAppIndex = -1; mIccCardStatus.mGsmUmtsSubscriptionAppIndex = -1; Message mProfileUpdate = mHandler.obtainMessage(UICCPROFILE_UPDATE_APPLICATION_EVENT); setReady(false); mProfileUpdate.sendToTarget(); waitUntilReady(); /* wait for the carrier privilege rules to be loaded */ waitForMs(50); assertEquals(1, mUiccProfile.getNumApplications()); mUiccProfile.sendMessage(mUiccProfile.obtainMessage(EVENT_APP_READY)); waitForMs(SCARY_SLEEP_MS); // state is loaded since there is no applications. assertEquals(State.NOT_READY, mUiccProfile.getState()); } }