UICC: Handle card level REFRESH RESET events.
Currently the platform assumes that on a UICC REFRESH RESET, the radio will
send out individual RESETs for each of the applets. In the case of N6 that
does not seem to be the case, where only a card level RESET is indicated to
Android.
The change will dispose the applet caches on both card level resets as well as
applet level resets.
Bug: 19379406
Change-Id: Ie9081fc6867a89c566229c305e10bca4162c0178
diff --git a/src/java/com/android/internal/telephony/uicc/UiccCard.java b/src/java/com/android/internal/telephony/uicc/UiccCard.java
index e2b6689..f77a16c 100644
--- a/src/java/com/android/internal/telephony/uicc/UiccCard.java
+++ b/src/java/com/android/internal/telephony/uicc/UiccCard.java
@@ -458,19 +458,25 @@
/**
* Resets the application with the input AID. Returns true if any changes were made.
+ *
+ * A null aid implies a card level reset - all applications must be reset.
*/
public boolean resetAppWithAid(String aid) {
synchronized (mLock) {
+ boolean changed = false;
for (int i = 0; i < mUiccApplications.length; i++) {
- if (mUiccApplications[i] != null && aid.equals(mUiccApplications[i].getAid())) {
+ if (mUiccApplications[i] != null &&
+ (aid == null || aid.equals(mUiccApplications[i].getAid()))) {
// Delete removed applications
mUiccApplications[i].dispose();
mUiccApplications[i] = null;
- return true;
+ changed = true;
}
}
- return false;
+ return changed;
}
+ // TODO: For a card level notification, we should delete the CarrierPrivilegeRules and the
+ // CAT service.
}
/**
diff --git a/src/java/com/android/internal/telephony/uicc/UiccController.java b/src/java/com/android/internal/telephony/uicc/UiccController.java
index 80893f2..e314f82 100644
--- a/src/java/com/android/internal/telephony/uicc/UiccController.java
+++ b/src/java/com/android/internal/telephony/uicc/UiccController.java
@@ -312,12 +312,13 @@
return;
}
- if (resp.refreshResult != IccRefreshResponse.REFRESH_RESULT_RESET ||
- resp.aid == null) {
- Rlog.d(LOG_TAG, "Ignoring reset: " + resp);
- return;
+ if (resp.refreshResult != IccRefreshResponse.REFRESH_RESULT_RESET) {
+ Rlog.d(LOG_TAG, "Ignoring non reset refresh: " + resp);
+ return;
}
+ Rlog.d(LOG_TAG, "Handling refresh reset: " + resp);
+
boolean changed = mUiccCards[index].resetAppWithAid(resp.aid);
if (changed) {
boolean requirePowerOffOnSimRefreshReset = mContext.getResources().getBoolean(
@@ -329,8 +330,6 @@
}
mIccChangedRegistrants.notifyRegistrants(new AsyncResult(null, index, null));
}
- // TODO: For a card level notification, we should delete the CarrierPrivilegeRules and the
- // CAT service.
}
private boolean isValidCardIndex(int index) {