Loading src/java/com/android/internal/telephony/uicc/UiccProfile.java +12 −4 Original line number Diff line number Diff line Loading @@ -137,6 +137,11 @@ public class UiccProfile extends IccCard { private IccRecords mIccRecords = null; private IccCardConstants.State mExternalState = IccCardConstants.State.UNKNOWN; // The number of UiccApplications modem reported. It's different from mUiccApplications.length // which is always CARD_MAX_APPS, and only updated when modem sends an update, and NOT updated // during SIM refresh. It's currently only used to help identify empty profile. private int mLastReportedNumOfUiccApplications; private final ContentObserver mProvisionCompleteContentObserver = new ContentObserver(new Handler()) { @Override Loading Loading @@ -864,10 +869,11 @@ public class UiccProfile extends IccCard { public boolean isEmptyProfile() { // If there's no UiccCardApplication, it's an empty profile. // Empty profile is a valid case of eSIM (default boot profile). for (UiccCardApplication app : mUiccApplications) { if (app != null) return false; } return true; // But we clear all apps of mUiccCardApplication to be null during refresh (see // resetAppWithAid) but not mLastReportedNumOfUiccApplications. // So if mLastReportedNumOfUiccApplications == 0, it means modem confirmed that we landed // on empty profile. return mLastReportedNumOfUiccApplications == 0; } @Override Loading Loading @@ -964,6 +970,8 @@ public class UiccProfile extends IccCard { //update applications if (DBG) log(ics.mApplications.length + " applications"); mLastReportedNumOfUiccApplications = ics.mApplications.length; for (int i = 0; i < mUiccApplications.length; i++) { if (mUiccApplications[i] == null) { //Create newly added Applications Loading tests/telephonytests/src/com/android/internal/telephony/uicc/UiccProfileTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -630,4 +630,20 @@ public class UiccProfileTest extends TelephonyTest { } assertTrue(carrierFound); } @Test @SmallTest public void testIsEmptyProfile() { testUpdateUiccProfileApplication(); assertFalse(mUiccProfile.isEmptyProfile()); // Manually resetting app shouldn't indicate we are on empty profile. mUiccProfile.resetAppWithAid("", true); assertFalse(mUiccProfile.isEmptyProfile()); // If we update there's no application, then we are on empty profile. testUpdateUiccProfileApplicationNoApplication(); assertTrue(mUiccProfile.isEmptyProfile()); } } Loading
src/java/com/android/internal/telephony/uicc/UiccProfile.java +12 −4 Original line number Diff line number Diff line Loading @@ -137,6 +137,11 @@ public class UiccProfile extends IccCard { private IccRecords mIccRecords = null; private IccCardConstants.State mExternalState = IccCardConstants.State.UNKNOWN; // The number of UiccApplications modem reported. It's different from mUiccApplications.length // which is always CARD_MAX_APPS, and only updated when modem sends an update, and NOT updated // during SIM refresh. It's currently only used to help identify empty profile. private int mLastReportedNumOfUiccApplications; private final ContentObserver mProvisionCompleteContentObserver = new ContentObserver(new Handler()) { @Override Loading Loading @@ -864,10 +869,11 @@ public class UiccProfile extends IccCard { public boolean isEmptyProfile() { // If there's no UiccCardApplication, it's an empty profile. // Empty profile is a valid case of eSIM (default boot profile). for (UiccCardApplication app : mUiccApplications) { if (app != null) return false; } return true; // But we clear all apps of mUiccCardApplication to be null during refresh (see // resetAppWithAid) but not mLastReportedNumOfUiccApplications. // So if mLastReportedNumOfUiccApplications == 0, it means modem confirmed that we landed // on empty profile. return mLastReportedNumOfUiccApplications == 0; } @Override Loading Loading @@ -964,6 +970,8 @@ public class UiccProfile extends IccCard { //update applications if (DBG) log(ics.mApplications.length + " applications"); mLastReportedNumOfUiccApplications = ics.mApplications.length; for (int i = 0; i < mUiccApplications.length; i++) { if (mUiccApplications[i] == null) { //Create newly added Applications Loading
tests/telephonytests/src/com/android/internal/telephony/uicc/UiccProfileTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -630,4 +630,20 @@ public class UiccProfileTest extends TelephonyTest { } assertTrue(carrierFound); } @Test @SmallTest public void testIsEmptyProfile() { testUpdateUiccProfileApplication(); assertFalse(mUiccProfile.isEmptyProfile()); // Manually resetting app shouldn't indicate we are on empty profile. mUiccProfile.resetAppWithAid("", true); assertFalse(mUiccProfile.isEmptyProfile()); // If we update there's no application, then we are on empty profile. testUpdateUiccProfileApplicationNoApplication(); assertTrue(mUiccProfile.isEmptyProfile()); } }