Methods Summary |
---|
public void | changeIccFdnPassword(java.lang.String oldPassword, java.lang.String newPassword, android.os.Message onComplete)Change the ICC password used in ICC fdn enable
When the operation is complete, onComplete will be sent to its handler
synchronized (mLock) {
if (DBG) log("changeIccFdnPassword");
mCi.changeIccPin2ForApp(oldPassword, newPassword, mAid,
mHandler.obtainMessage(EVENT_CHANGE_PIN2_DONE, onComplete));
}
|
public void | changeIccLockPassword(java.lang.String oldPassword, java.lang.String newPassword, android.os.Message onComplete)Change the ICC password used in ICC pin lock
When the operation is complete, onComplete will be sent to its handler
synchronized (mLock) {
if (DBG) log("changeIccLockPassword");
mCi.changeIccPinForApp(oldPassword, newPassword, mAid,
mHandler.obtainMessage(EVENT_CHANGE_PIN1_DONE, onComplete));
}
|
private IccFileHandler | createIccFileHandler(com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType type)
switch (type) {
case APPTYPE_SIM:
return new SIMFileHandler(this, mAid, mCi);
case APPTYPE_RUIM:
return new RuimFileHandler(this, mAid, mCi);
case APPTYPE_USIM:
return new UsimFileHandler(this, mAid, mCi);
case APPTYPE_CSIM:
return new CsimFileHandler(this, mAid, mCi);
case APPTYPE_ISIM:
return new IsimFileHandler(this, mAid, mCi);
default:
return null;
}
|
private IccRecords | createIccRecords(com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType type, android.content.Context c, com.android.internal.telephony.CommandsInterface ci)
if (type == AppType.APPTYPE_USIM || type == AppType.APPTYPE_SIM) {
return new SIMRecords(this, c, ci);
} else if (type == AppType.APPTYPE_RUIM || type == AppType.APPTYPE_CSIM){
return new RuimRecords(this, c, ci);
} else if (type == AppType.APPTYPE_ISIM) {
return new IsimUiccRecords(this, c, ci);
} else {
// Unknown app type (maybe detection is still in progress)
return null;
}
|
void | dispose()
synchronized (mLock) {
if (DBG) log(mAppType + " being Disposed");
mDestroyed = true;
if (mIccRecords != null) { mIccRecords.dispose();}
if (mIccFh != null) { mIccFh.dispose();}
mIccRecords = null;
mIccFh = null;
mCi.unregisterForNotAvailable(mHandler);
}
|
public void | dump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)
pw.println("UiccCardApplication: " + this);
pw.println(" mUiccCard=" + mUiccCard);
pw.println(" mAppState=" + mAppState);
pw.println(" mAppType=" + mAppType);
pw.println(" mPersoSubState=" + mPersoSubState);
pw.println(" mAid=" + mAid);
pw.println(" mAppLabel=" + mAppLabel);
pw.println(" mPin1Replaced=" + mPin1Replaced);
pw.println(" mPin1State=" + mPin1State);
pw.println(" mPin2State=" + mPin2State);
pw.println(" mIccFdnEnabled=" + mIccFdnEnabled);
pw.println(" mDesiredFdnEnabled=" + mDesiredFdnEnabled);
pw.println(" mIccLockEnabled=" + mIccLockEnabled);
pw.println(" mDesiredPinLocked=" + mDesiredPinLocked);
pw.println(" mCi=" + mCi);
pw.println(" mIccRecords=" + mIccRecords);
pw.println(" mIccFh=" + mIccFh);
pw.println(" mDestroyed=" + mDestroyed);
pw.println(" mReadyRegistrants: size=" + mReadyRegistrants.size());
for (int i = 0; i < mReadyRegistrants.size(); i++) {
pw.println(" mReadyRegistrants[" + i + "]="
+ ((Registrant)mReadyRegistrants.get(i)).getHandler());
}
pw.println(" mPinLockedRegistrants: size=" + mPinLockedRegistrants.size());
for (int i = 0; i < mPinLockedRegistrants.size(); i++) {
pw.println(" mPinLockedRegistrants[" + i + "]="
+ ((Registrant)mPinLockedRegistrants.get(i)).getHandler());
}
pw.println(" mNetworkLockedRegistrants: size=" + mNetworkLockedRegistrants.size());
for (int i = 0; i < mNetworkLockedRegistrants.size(); i++) {
pw.println(" mNetworkLockedRegistrants[" + i + "]="
+ ((Registrant)mNetworkLockedRegistrants.get(i)).getHandler());
}
pw.flush();
|
public java.lang.String | getAid()
synchronized (mLock) {
return mAid;
}
|
public java.lang.String | getAppLabel()
return mAppLabel;
|
public int | getAuthContext()
synchronized (mLock) {
return mAuthContext;
}
|
private static int | getAuthContext(com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType appType)Returns the authContext based on the type of UiccCard.
int authContext;
switch (appType) {
case APPTYPE_SIM:
authContext = AUTH_CONTEXT_EAP_SIM;
break;
case APPTYPE_USIM:
authContext = AUTH_CONTEXT_EAP_AKA;
break;
default:
authContext = AUTH_CONTEXT_UNDEFINED;
break;
}
return authContext;
|
public boolean | getIccFdnAvailable()Check whether fdn (fixed dialing number) service is available.
return mIccFdnAvailable;
|
public boolean | getIccFdnEnabled()Check whether ICC fdn (fixed dialing number) is enabled
This is a sync call which returns the cached pin enabled state
synchronized (mLock) {
return mIccFdnEnabled;
}
|
public IccFileHandler | getIccFileHandler()
synchronized (mLock) {
return mIccFh;
}
|
public boolean | getIccLockEnabled()Check whether ICC pin lock is enabled
This is a sync call which returns the cached pin enabled state
return mIccLockEnabled;
/* STOPSHIP: Remove line above and all code associated with setting
mIccLockEanbled once all RIL correctly sends the pin1 state.
// Use getPin1State to take into account pin1Replaced flag
PinState pinState = getPin1State();
return pinState == PinState.PINSTATE_ENABLED_NOT_VERIFIED ||
pinState == PinState.PINSTATE_ENABLED_VERIFIED ||
pinState == PinState.PINSTATE_ENABLED_BLOCKED ||
pinState == PinState.PINSTATE_ENABLED_PERM_BLOCKED;*/
|
public boolean | getIccPin2Blocked()
synchronized (mLock) {
return mPin2State == PinState.PINSTATE_ENABLED_BLOCKED;
}
|
public boolean | getIccPuk2Blocked()
synchronized (mLock) {
return mPin2State == PinState.PINSTATE_ENABLED_PERM_BLOCKED;
}
|
public IccRecords | getIccRecords()
synchronized (mLock) {
return mIccRecords;
}
|
public com.android.internal.telephony.uicc.IccCardApplicationStatus.PersoSubState | getPersoSubState()
synchronized (mLock) {
return mPersoSubState;
}
|
public int | getPhoneId()
return mUiccCard.getPhoneId();
|
public com.android.internal.telephony.uicc.IccCardStatus.PinState | getPin1State()
synchronized (mLock) {
if (mPin1Replaced) {
return mUiccCard.getUniversalPinState();
}
return mPin1State;
}
|
public com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState | getState()
synchronized (mLock) {
return mAppState;
}
|
public com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType | getType()
synchronized (mLock) {
return mAppType;
}
|
protected UiccCard | getUiccCard()
return mUiccCard;
|
private void | log(java.lang.String msg)
Rlog.d(LOG_TAG, msg);
|
private void | loge(java.lang.String msg)
Rlog.e(LOG_TAG, msg);
|
private void | notifyNetworkLockedRegistrantsIfNeeded(android.os.Registrant r)Notifies specified registrant, assume mLock is held.
if (mDestroyed) {
return;
}
if (mAppState == AppState.APPSTATE_SUBSCRIPTION_PERSO &&
mPersoSubState == PersoSubState.PERSOSUBSTATE_SIM_NETWORK) {
if (r == null) {
if (DBG) log("Notifying registrants: NETWORK_LOCKED");
mNetworkLockedRegistrants.notifyRegistrants();
} else {
if (DBG) log("Notifying 1 registrant: NETWORK_LOCED");
r.notifyRegistrant(new AsyncResult(null, null, null));
}
}
|
private void | notifyPinLockedRegistrantsIfNeeded(android.os.Registrant r)Notifies specified registrant, assume mLock is held.
if (mDestroyed) {
return;
}
if (mAppState == AppState.APPSTATE_PIN ||
mAppState == AppState.APPSTATE_PUK) {
if (mPin1State == PinState.PINSTATE_ENABLED_VERIFIED ||
mPin1State == PinState.PINSTATE_DISABLED) {
loge("Sanity check failed! APPSTATE is locked while PIN1 is not!!!");
//Don't notify if application is in insane state
return;
}
if (r == null) {
if (DBG) log("Notifying registrants: LOCKED");
mPinLockedRegistrants.notifyRegistrants();
} else {
if (DBG) log("Notifying 1 registrant: LOCKED");
r.notifyRegistrant(new AsyncResult(null, null, null));
}
}
|
private void | notifyReadyRegistrantsIfNeeded(android.os.Registrant r)Notifies specified registrant, assume mLock is held.
if (mDestroyed) {
return;
}
if (mAppState == AppState.APPSTATE_READY) {
if (mPin1State == PinState.PINSTATE_ENABLED_NOT_VERIFIED ||
mPin1State == PinState.PINSTATE_ENABLED_BLOCKED ||
mPin1State == PinState.PINSTATE_ENABLED_PERM_BLOCKED) {
loge("Sanity check failed! APPSTATE is ready while PIN1 is not verified!!!");
// Don't notify if application is in insane state
return;
}
if (r == null) {
if (DBG) log("Notifying registrants: READY");
mReadyRegistrants.notifyRegistrants();
} else {
if (DBG) log("Notifying 1 registrant: READY");
r.notifyRegistrant(new AsyncResult(null, null, null));
}
}
|
private void | onChangeFacilityLock(android.os.AsyncResult ar)REMOVE when mIccLockEnabled is not needed
synchronized (mLock) {
int attemptsRemaining = -1;
if (ar.exception == null) {
mIccLockEnabled = mDesiredPinLocked;
if (DBG) log( "EVENT_CHANGE_FACILITY_LOCK_DONE: mIccLockEnabled= "
+ mIccLockEnabled);
} else {
attemptsRemaining = parsePinPukErrorResult(ar);
loge("Error change facility lock with exception " + ar.exception);
}
Message response = (Message)ar.userObj;
AsyncResult.forMessage(response).exception = ar.exception;
response.arg1 = attemptsRemaining;
response.sendToTarget();
}
|
private void | onChangeFdnDone(android.os.AsyncResult ar)
synchronized (mLock) {
int attemptsRemaining = -1;
if (ar.exception == null) {
mIccFdnEnabled = mDesiredFdnEnabled;
if (DBG) log("EVENT_CHANGE_FACILITY_FDN_DONE: " +
"mIccFdnEnabled=" + mIccFdnEnabled);
} else {
attemptsRemaining = parsePinPukErrorResult(ar);
loge("Error change facility fdn with exception " + ar.exception);
}
Message response = (Message)ar.userObj;
response.arg1 = attemptsRemaining;
AsyncResult.forMessage(response).exception = ar.exception;
response.sendToTarget();
}
|
private void | onQueryFacilityLock(android.os.AsyncResult ar)REMOVE when mIccLockEnabled is not needed
synchronized (mLock) {
if(ar.exception != null) {
if (DBG) log("Error in querying facility lock:" + ar.exception);
return;
}
int[] ints = (int[])ar.result;
if(ints.length != 0) {
if (DBG) log("Query facility lock : " + ints[0]);
mIccLockEnabled = (ints[0] != 0);
if (mIccLockEnabled) {
mPinLockedRegistrants.notifyRegistrants();
}
// Sanity check: we expect mPin1State to match mIccLockEnabled.
// When mPin1State is DISABLED mIccLockEanbled should be false.
// When mPin1State is ENABLED mIccLockEnabled should be true.
//
// Here we validate these assumptions to assist in identifying which ril/radio's
// have not correctly implemented GET_SIM_STATUS
switch (mPin1State) {
case PINSTATE_DISABLED:
if (mIccLockEnabled) {
loge("QUERY_FACILITY_LOCK:enabled GET_SIM_STATUS.Pin1:disabled."
+ " Fixme");
}
break;
case PINSTATE_ENABLED_NOT_VERIFIED:
case PINSTATE_ENABLED_VERIFIED:
case PINSTATE_ENABLED_BLOCKED:
case PINSTATE_ENABLED_PERM_BLOCKED:
if (!mIccLockEnabled) {
loge("QUERY_FACILITY_LOCK:disabled GET_SIM_STATUS.Pin1:enabled."
+ " Fixme");
}
case PINSTATE_UNKNOWN:
default:
if (DBG) log("Ignoring: pin1state=" + mPin1State);
break;
}
} else {
loge("Bogus facility lock response");
}
}
|
private void | onQueryFdnEnabled(android.os.AsyncResult ar)Interpret EVENT_QUERY_FACILITY_LOCK_DONE
synchronized (mLock) {
if (ar.exception != null) {
if (DBG) log("Error in querying facility lock:" + ar.exception);
return;
}
int[] result = (int[])ar.result;
if(result.length != 0) {
//0 - Available & Disabled, 1-Available & Enabled, 2-Unavailable.
if (result[0] == 2) {
mIccFdnEnabled = false;
mIccFdnAvailable = false;
} else {
mIccFdnEnabled = (result[0] == 1) ? true : false;
mIccFdnAvailable = true;
}
log("Query facility FDN : FDN service available: "+ mIccFdnAvailable
+" enabled: " + mIccFdnEnabled);
} else {
loge("Bogus facility lock response");
}
}
|
private int | parsePinPukErrorResult(android.os.AsyncResult ar)Parse the error response to obtain number of attempts remaining
int[] result = (int[]) ar.result;
if (result == null) {
return -1;
} else {
int length = result.length;
int attemptsRemaining = -1;
if (length > 0) {
attemptsRemaining = result[0];
}
log("parsePinPukErrorResult: attemptsRemaining=" + attemptsRemaining);
return attemptsRemaining;
}
|
void | queryFdn()Assumes mLock is held.
//This shouldn't change run-time. So needs to be called only once.
int serviceClassX;
serviceClassX = CommandsInterface.SERVICE_CLASS_VOICE +
CommandsInterface.SERVICE_CLASS_DATA +
CommandsInterface.SERVICE_CLASS_FAX;
mCi.queryFacilityLockForApp (
CommandsInterface.CB_FACILITY_BA_FD, "", serviceClassX,
mAid, mHandler.obtainMessage(EVENT_QUERY_FACILITY_FDN_DONE));
|
private void | queryPin1State()REMOVE when mIccLockEnabled is not needed, assumes mLock is held
int serviceClassX = CommandsInterface.SERVICE_CLASS_VOICE +
CommandsInterface.SERVICE_CLASS_DATA +
CommandsInterface.SERVICE_CLASS_FAX;
mCi.queryFacilityLockForApp (
CommandsInterface.CB_FACILITY_BA_SIM, "", serviceClassX,
mAid, mHandler.obtainMessage(EVENT_QUERY_FACILITY_LOCK_DONE));
|
public void | registerForLocked(android.os.Handler h, int what, java.lang.Object obj)Notifies handler of any transition into State.isPinLocked()
synchronized (mLock) {
Registrant r = new Registrant (h, what, obj);
mPinLockedRegistrants.add(r);
notifyPinLockedRegistrantsIfNeeded(r);
}
|
public void | registerForNetworkLocked(android.os.Handler h, int what, java.lang.Object obj)Notifies handler of any transition into State.NETWORK_LOCKED
synchronized (mLock) {
Registrant r = new Registrant (h, what, obj);
mNetworkLockedRegistrants.add(r);
notifyNetworkLockedRegistrantsIfNeeded(r);
}
|
public void | registerForReady(android.os.Handler h, int what, java.lang.Object obj)
synchronized (mLock) {
Registrant r = new Registrant (h, what, obj);
mReadyRegistrants.add(r);
notifyReadyRegistrantsIfNeeded(r);
}
|
public void | setIccFdnEnabled(boolean enabled, java.lang.String password, android.os.Message onComplete)Set the ICC fdn enabled or disabled
When the operation is complete, onComplete will be sent to its handler
synchronized (mLock) {
int serviceClassX;
serviceClassX = CommandsInterface.SERVICE_CLASS_VOICE +
CommandsInterface.SERVICE_CLASS_DATA +
CommandsInterface.SERVICE_CLASS_FAX +
CommandsInterface.SERVICE_CLASS_SMS;
mDesiredFdnEnabled = enabled;
mCi.setFacilityLockForApp(CommandsInterface.CB_FACILITY_BA_FD,
enabled, password, serviceClassX, mAid,
mHandler.obtainMessage(EVENT_CHANGE_FACILITY_FDN_DONE, onComplete));
}
|
public void | setIccLockEnabled(boolean enabled, java.lang.String password, android.os.Message onComplete)Set the ICC pin lock enabled or disabled
When the operation is complete, onComplete will be sent to its handler
synchronized (mLock) {
int serviceClassX;
serviceClassX = CommandsInterface.SERVICE_CLASS_VOICE +
CommandsInterface.SERVICE_CLASS_DATA +
CommandsInterface.SERVICE_CLASS_FAX;
mDesiredPinLocked = enabled;
mCi.setFacilityLockForApp(CommandsInterface.CB_FACILITY_BA_SIM,
enabled, password, serviceClassX, mAid,
mHandler.obtainMessage(EVENT_CHANGE_FACILITY_LOCK_DONE, onComplete));
}
|
public void | supplyNetworkDepersonalization(java.lang.String pin, android.os.Message onComplete)
synchronized (mLock) {
if (DBG) log("supplyNetworkDepersonalization");
mCi.supplyNetworkDepersonalization(pin, onComplete);
}
|
public void | supplyPin(java.lang.String pin, android.os.Message onComplete)Supply the ICC PIN to the ICC
When the operation is complete, onComplete will be sent to its
Handler.
onComplete.obj will be an AsyncResult
onComplete.arg1 = remaining attempts before puk locked or -1 if unknown
((AsyncResult)onComplete.obj).exception == null on success
((AsyncResult)onComplete.obj).exception != null on fail
If the supplied PIN is incorrect:
((AsyncResult)onComplete.obj).exception != null
&& ((AsyncResult)onComplete.obj).exception
instanceof com.android.internal.telephony.gsm.CommandException)
&& ((CommandException)(((AsyncResult)onComplete.obj).exception))
.getCommandError() == CommandException.Error.PASSWORD_INCORRECT
synchronized (mLock) {
mCi.supplyIccPinForApp(pin, mAid, mHandler.obtainMessage(EVENT_PIN1_PUK1_DONE,
onComplete));
}
|
public void | supplyPin2(java.lang.String pin2, android.os.Message onComplete)
synchronized (mLock) {
mCi.supplyIccPin2ForApp(pin2, mAid,
mHandler.obtainMessage(EVENT_PIN2_PUK2_DONE, onComplete));
}
|
public void | supplyPuk(java.lang.String puk, java.lang.String newPin, android.os.Message onComplete)Supply the ICC PUK to the ICC
When the operation is complete, onComplete will be sent to its
Handler.
onComplete.obj will be an AsyncResult
onComplete.arg1 = remaining attempts before Icc will be permanently unusable
or -1 if unknown
((AsyncResult)onComplete.obj).exception == null on success
((AsyncResult)onComplete.obj).exception != null on fail
If the supplied PIN is incorrect:
((AsyncResult)onComplete.obj).exception != null
&& ((AsyncResult)onComplete.obj).exception
instanceof com.android.internal.telephony.gsm.CommandException)
&& ((CommandException)(((AsyncResult)onComplete.obj).exception))
.getCommandError() == CommandException.Error.PASSWORD_INCORRECT
synchronized (mLock) {
mCi.supplyIccPukForApp(puk, newPin, mAid,
mHandler.obtainMessage(EVENT_PIN1_PUK1_DONE, onComplete));
}
|
public void | supplyPuk2(java.lang.String puk2, java.lang.String newPin2, android.os.Message onComplete)
synchronized (mLock) {
mCi.supplyIccPuk2ForApp(puk2, newPin2, mAid,
mHandler.obtainMessage(EVENT_PIN2_PUK2_DONE, onComplete));
}
|
public void | unregisterForLocked(android.os.Handler h)
synchronized (mLock) {
mPinLockedRegistrants.remove(h);
}
|
public void | unregisterForNetworkLocked(android.os.Handler h)
synchronized (mLock) {
mNetworkLockedRegistrants.remove(h);
}
|
public void | unregisterForReady(android.os.Handler h)
synchronized (mLock) {
mReadyRegistrants.remove(h);
}
|
void | update(IccCardApplicationStatus as, android.content.Context c, com.android.internal.telephony.CommandsInterface ci)
synchronized (mLock) {
if (mDestroyed) {
loge("Application updated after destroyed! Fix me!");
return;
}
if (DBG) log(mAppType + " update. New " + as);
mContext = c;
mCi = ci;
AppType oldAppType = mAppType;
AppState oldAppState = mAppState;
PersoSubState oldPersoSubState = mPersoSubState;
mAppType = as.app_type;
mAuthContext = getAuthContext(mAppType);
mAppState = as.app_state;
mPersoSubState = as.perso_substate;
mAid = as.aid;
mAppLabel = as.app_label;
mPin1Replaced = (as.pin1_replaced != 0);
mPin1State = as.pin1;
mPin2State = as.pin2;
if (mAppType != oldAppType) {
if (mIccFh != null) { mIccFh.dispose();}
if (mIccRecords != null) { mIccRecords.dispose();}
mIccFh = createIccFileHandler(as.app_type);
mIccRecords = createIccRecords(as.app_type, c, ci);
}
if (mPersoSubState != oldPersoSubState &&
mPersoSubState == PersoSubState.PERSOSUBSTATE_SIM_NETWORK) {
notifyNetworkLockedRegistrantsIfNeeded(null);
}
if (mAppState != oldAppState) {
if (DBG) log(oldAppType + " changed state: " + oldAppState + " -> " + mAppState);
// If the app state turns to APPSTATE_READY, then query FDN status,
//as it might have failed in earlier attempt.
if (mAppState == AppState.APPSTATE_READY) {
queryFdn();
queryPin1State();
}
notifyPinLockedRegistrantsIfNeeded(null);
notifyReadyRegistrantsIfNeeded(null);
}
}
|