Loading src/java/com/android/internal/telephony/uicc/UiccCarrierPrivilegeRules.java +33 −8 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.telephony.Rlog; import android.telephony.TelephonyManager; import android.telephony.UiccAccessRule; import android.text.TextUtils; import android.util.LocalLog; import com.android.internal.telephony.CommandException; Loading Loading @@ -185,7 +186,8 @@ public class UiccCarrierPrivilegeRules extends Handler { private List<UiccAccessRule> mAccessRules; private String mRules; private Message mLoadedCallback; private String mStatusMessage; // Only used for debugging. // LocalLog buffer to hold important status messages for debugging. private LocalLog mStatusMessage = new LocalLog(100); private int mChannelId; // Channel Id for communicating with UICC. private int mRetryCount; // Number of retries for open logical channel. private boolean mCheckedRules = false; // Flag that used to mark whether get rules from ARA-D. Loading @@ -209,7 +211,7 @@ public class UiccCarrierPrivilegeRules extends Handler { log("Creating UiccCarrierPrivilegeRules"); mUiccProfile = uiccProfile; mState = new AtomicInteger(STATE_LOADING); mStatusMessage = "Not loaded."; mStatusMessage.log("Not loaded."); mLoadedCallback = loadedCallback; mRules = ""; mAccessRules = new ArrayList<>(); Loading Loading @@ -447,7 +449,7 @@ public class UiccCarrierPrivilegeRules extends Handler { if (mAIDInUse == ARAD) { // Open logical channel with ARA_M. mRules = ""; openChannel(1); openChannel(ARAM); } if (mAIDInUse == ARAM) { if (mCheckedRules) { Loading @@ -456,6 +458,13 @@ public class UiccCarrierPrivilegeRules extends Handler { // if rules cannot be read from both ARA_D and ARA_M applet, // fallback to PKCS15-based ARF. log("No ARA, try ARF next."); if (ar.exception instanceof CommandException && ((CommandException) (ar.exception)).getCommandError() != CommandException.Error.NO_SUCH_ELEMENT) { updateStatusMessage("No ARA due to " + ((CommandException) (ar.exception)).getCommandError()); } mUiccPkcs15 = new UiccPkcs15(mUiccProfile, obtainMessage(EVENT_PKCS15_READ_DONE)); } Loading Loading @@ -501,8 +510,19 @@ public class UiccCarrierPrivilegeRules extends Handler { } } } else { if (mAIDInUse == ARAM) { updateState(STATE_ERROR, "Error reading value from SIM."); String errorMsg = "Error reading value from SIM via " + ((mAIDInUse == ARAD) ? "ARAD" : "ARAM") + " due to "; if (ar.exception instanceof CommandException) { CommandException.Error errorCode = ((CommandException) (ar.exception)).getCommandError(); errorMsg += "error code : " + errorCode; } else { errorMsg += "unknown exception : " + ar.exception.getMessage(); } if (mAIDInUse == ARAD) { updateStatusMessage(errorMsg); } else { updateState(STATE_ERROR, errorMsg); } } Loading @@ -516,7 +536,7 @@ public class UiccCarrierPrivilegeRules extends Handler { if (mAIDInUse == ARAD) { // Close logical channel with ARA_D and then open logical channel with ARA_M. mRules = ""; openChannel(1); openChannel(ARAM); } break; Loading Loading @@ -667,7 +687,11 @@ public class UiccCarrierPrivilegeRules extends Handler { mLoadedCallback.sendToTarget(); } mStatusMessage = statusMessage; updateStatusMessage(statusMessage); } private void updateStatusMessage(String statusMessage) { mStatusMessage.log(statusMessage); } private static void log(String msg) { Loading @@ -680,7 +704,8 @@ public class UiccCarrierPrivilegeRules extends Handler { public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("UiccCarrierPrivilegeRules: " + this); pw.println(" mState=" + getStateString(mState.get())); pw.println(" mStatusMessage='" + mStatusMessage + "'"); pw.println(" mStatusMessage="); mStatusMessage.dump(fd, pw, args); if (mAccessRules != null) { pw.println(" mAccessRules: "); for (UiccAccessRule ar : mAccessRules) { Loading src/java/com/android/internal/telephony/uicc/UiccPkcs15.java +41 −40 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ public class UiccPkcs15 extends Handler { private UiccProfile mUiccProfile; // Parent private Message mLoadedCallback; private int mChannelId = -1; // Channel Id for communicating with UICC. private List<String> mRules = new ArrayList<String>(); private List<String> mRules = null; private Pkcs15Selector mPkcs15Selector; private FileHandler mFh; Loading Loading @@ -212,6 +212,7 @@ public class UiccPkcs15 extends Handler { case EVENT_LOAD_ACRF_DONE: if (ar.exception == null && ar.result != null) { mRules = new ArrayList<String>(); String idAccf = parseAcrf((String) ar.result); if (!mFh.loadFile(idAccf, obtainMessage(EVENT_LOAD_ACCF_DONE))) { cleanUp(); Loading Loading
src/java/com/android/internal/telephony/uicc/UiccCarrierPrivilegeRules.java +33 −8 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.telephony.Rlog; import android.telephony.TelephonyManager; import android.telephony.UiccAccessRule; import android.text.TextUtils; import android.util.LocalLog; import com.android.internal.telephony.CommandException; Loading Loading @@ -185,7 +186,8 @@ public class UiccCarrierPrivilegeRules extends Handler { private List<UiccAccessRule> mAccessRules; private String mRules; private Message mLoadedCallback; private String mStatusMessage; // Only used for debugging. // LocalLog buffer to hold important status messages for debugging. private LocalLog mStatusMessage = new LocalLog(100); private int mChannelId; // Channel Id for communicating with UICC. private int mRetryCount; // Number of retries for open logical channel. private boolean mCheckedRules = false; // Flag that used to mark whether get rules from ARA-D. Loading @@ -209,7 +211,7 @@ public class UiccCarrierPrivilegeRules extends Handler { log("Creating UiccCarrierPrivilegeRules"); mUiccProfile = uiccProfile; mState = new AtomicInteger(STATE_LOADING); mStatusMessage = "Not loaded."; mStatusMessage.log("Not loaded."); mLoadedCallback = loadedCallback; mRules = ""; mAccessRules = new ArrayList<>(); Loading Loading @@ -447,7 +449,7 @@ public class UiccCarrierPrivilegeRules extends Handler { if (mAIDInUse == ARAD) { // Open logical channel with ARA_M. mRules = ""; openChannel(1); openChannel(ARAM); } if (mAIDInUse == ARAM) { if (mCheckedRules) { Loading @@ -456,6 +458,13 @@ public class UiccCarrierPrivilegeRules extends Handler { // if rules cannot be read from both ARA_D and ARA_M applet, // fallback to PKCS15-based ARF. log("No ARA, try ARF next."); if (ar.exception instanceof CommandException && ((CommandException) (ar.exception)).getCommandError() != CommandException.Error.NO_SUCH_ELEMENT) { updateStatusMessage("No ARA due to " + ((CommandException) (ar.exception)).getCommandError()); } mUiccPkcs15 = new UiccPkcs15(mUiccProfile, obtainMessage(EVENT_PKCS15_READ_DONE)); } Loading Loading @@ -501,8 +510,19 @@ public class UiccCarrierPrivilegeRules extends Handler { } } } else { if (mAIDInUse == ARAM) { updateState(STATE_ERROR, "Error reading value from SIM."); String errorMsg = "Error reading value from SIM via " + ((mAIDInUse == ARAD) ? "ARAD" : "ARAM") + " due to "; if (ar.exception instanceof CommandException) { CommandException.Error errorCode = ((CommandException) (ar.exception)).getCommandError(); errorMsg += "error code : " + errorCode; } else { errorMsg += "unknown exception : " + ar.exception.getMessage(); } if (mAIDInUse == ARAD) { updateStatusMessage(errorMsg); } else { updateState(STATE_ERROR, errorMsg); } } Loading @@ -516,7 +536,7 @@ public class UiccCarrierPrivilegeRules extends Handler { if (mAIDInUse == ARAD) { // Close logical channel with ARA_D and then open logical channel with ARA_M. mRules = ""; openChannel(1); openChannel(ARAM); } break; Loading Loading @@ -667,7 +687,11 @@ public class UiccCarrierPrivilegeRules extends Handler { mLoadedCallback.sendToTarget(); } mStatusMessage = statusMessage; updateStatusMessage(statusMessage); } private void updateStatusMessage(String statusMessage) { mStatusMessage.log(statusMessage); } private static void log(String msg) { Loading @@ -680,7 +704,8 @@ public class UiccCarrierPrivilegeRules extends Handler { public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("UiccCarrierPrivilegeRules: " + this); pw.println(" mState=" + getStateString(mState.get())); pw.println(" mStatusMessage='" + mStatusMessage + "'"); pw.println(" mStatusMessage="); mStatusMessage.dump(fd, pw, args); if (mAccessRules != null) { pw.println(" mAccessRules: "); for (UiccAccessRule ar : mAccessRules) { Loading
src/java/com/android/internal/telephony/uicc/UiccPkcs15.java +41 −40 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ public class UiccPkcs15 extends Handler { private UiccProfile mUiccProfile; // Parent private Message mLoadedCallback; private int mChannelId = -1; // Channel Id for communicating with UICC. private List<String> mRules = new ArrayList<String>(); private List<String> mRules = null; private Pkcs15Selector mPkcs15Selector; private FileHandler mFh; Loading Loading @@ -212,6 +212,7 @@ public class UiccPkcs15 extends Handler { case EVENT_LOAD_ACRF_DONE: if (ar.exception == null && ar.result != null) { mRules = new ArrayList<String>(); String idAccf = parseAcrf((String) ar.result); if (!mFh.loadFile(idAccf, obtainMessage(EVENT_LOAD_ACCF_DONE))) { cleanUp(); Loading