FileDocCategorySizeDatePackage
UiccCardApplication.javaAPI DocAndroid 5.1 API33711Thu Mar 12 22:22:54 GMT 2015com.android.internal.telephony.uicc

UiccCardApplication

public class UiccCardApplication extends Object
{@hide}

Fields Summary
private static final String
LOG_TAG
private static final boolean
DBG
private static final int
EVENT_PIN1_PUK1_DONE
private static final int
EVENT_CHANGE_PIN1_DONE
private static final int
EVENT_CHANGE_PIN2_DONE
private static final int
EVENT_QUERY_FACILITY_FDN_DONE
private static final int
EVENT_CHANGE_FACILITY_FDN_DONE
private static final int
EVENT_QUERY_FACILITY_LOCK_DONE
private static final int
EVENT_CHANGE_FACILITY_LOCK_DONE
private static final int
EVENT_PIN2_PUK2_DONE
private static final int
EVENT_RADIO_UNAVAILABLE
public static final int
AUTH_CONTEXT_EAP_SIM
These values are for authContext (parameter P2) per 3GPP TS 31.102 (Section 7.1.2)
public static final int
AUTH_CONTEXT_EAP_AKA
public static final int
AUTH_CONTEXT_UNDEFINED
private final Object
mLock
private UiccCard
mUiccCard
private com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState
mAppState
private com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType
mAppType
private int
mAuthContext
private com.android.internal.telephony.uicc.IccCardApplicationStatus.PersoSubState
mPersoSubState
private String
mAid
private String
mAppLabel
private boolean
mPin1Replaced
private com.android.internal.telephony.uicc.IccCardStatus.PinState
mPin1State
private com.android.internal.telephony.uicc.IccCardStatus.PinState
mPin2State
private boolean
mIccFdnEnabled
private boolean
mDesiredFdnEnabled
private boolean
mIccLockEnabled
private boolean
mDesiredPinLocked
private boolean
mIccFdnAvailable
private com.android.internal.telephony.CommandsInterface
mCi
private android.content.Context
mContext
private IccRecords
mIccRecords
private IccFileHandler
mIccFh
private boolean
mDestroyed
private android.os.RegistrantList
mReadyRegistrants
private android.os.RegistrantList
mPinLockedRegistrants
private android.os.RegistrantList
mNetworkLockedRegistrants
private android.os.Handler
mHandler
Constructors Summary
UiccCardApplication(UiccCard uiccCard, IccCardApplicationStatus as, android.content.Context c, com.android.internal.telephony.CommandsInterface ci)


     
                         
                         
                          
        if (DBG) log("Creating UiccApp: " + as);
        mUiccCard = uiccCard;
        mAppState = as.app_state;
        mAppType = as.app_type;
        mAuthContext = getAuthContext(mAppType);
        mPersoSubState = as.perso_substate;
        mAid = as.aid;
        mAppLabel = as.app_label;
        mPin1Replaced = (as.pin1_replaced != 0);
        mPin1State = as.pin1;
        mPin2State = as.pin2;

        mContext = c;
        mCi = ci;

        mIccFh = createIccFileHandler(as.app_type);
        mIccRecords = createIccRecords(as.app_type, mContext, mCi);
        if (mAppState == AppState.APPSTATE_READY) {
            queryFdn();
            queryPin1State();
        }
        mCi.registerForNotAvailable(mHandler, EVENT_RADIO_UNAVAILABLE, null);
    
Methods Summary
public voidchangeIccFdnPassword(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

param
oldPassword is the old password
param
newPassword is the new password
param
onComplete onComplete.obj will be an AsyncResult ((AsyncResult)onComplete.obj).exception == null on success ((AsyncResult)onComplete.obj).exception != null on fail

        synchronized (mLock) {
            if (DBG) log("changeIccFdnPassword");
            mCi.changeIccPin2ForApp(oldPassword, newPassword, mAid,
                    mHandler.obtainMessage(EVENT_CHANGE_PIN2_DONE, onComplete));
        }
    
public voidchangeIccLockPassword(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

param
oldPassword is the old password
param
newPassword is the new password
param
onComplete onComplete.obj will be an AsyncResult onComplete.arg1 = attempts remaining or -1 if unknown ((AsyncResult)onComplete.obj).exception == null on success ((AsyncResult)onComplete.obj).exception != null on fail

        synchronized (mLock) {
            if (DBG) log("changeIccLockPassword");
            mCi.changeIccPinForApp(oldPassword, newPassword, mAid,
                    mHandler.obtainMessage(EVENT_CHANGE_PIN1_DONE, onComplete));
        }
    
private IccFileHandlercreateIccFileHandler(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 IccRecordscreateIccRecords(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;
        }
    
voiddispose()

        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 voiddump(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.StringgetAid()

        synchronized (mLock) {
            return mAid;
        }
    
public java.lang.StringgetAppLabel()

        return mAppLabel;
    
public intgetAuthContext()

        synchronized (mLock) {
            return mAuthContext;
        }
    
private static intgetAuthContext(com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType appType)
Returns the authContext based on the type of UiccCard.

param
appType the app type
return
authContext corresponding to the type or AUTH_CONTEXT_UNDEFINED if appType not supported

        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 booleangetIccFdnAvailable()
Check whether fdn (fixed dialing number) service is available.

return
true if ICC fdn service available false if ICC fdn service not available

        return mIccFdnAvailable;
    
public booleangetIccFdnEnabled()
Check whether ICC fdn (fixed dialing number) is enabled This is a sync call which returns the cached pin enabled state

return
true for ICC fdn enabled false for ICC fdn disabled

        synchronized (mLock) {
            return mIccFdnEnabled;
        }
    
public IccFileHandlergetIccFileHandler()

        synchronized (mLock) {
            return mIccFh;
        }
    
public booleangetIccLockEnabled()
Check whether ICC pin lock is enabled This is a sync call which returns the cached pin enabled state

return
true for ICC locked enabled false for ICC locked disabled

        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 booleangetIccPin2Blocked()

return
true if ICC card is PIN2 blocked

        synchronized (mLock) {
            return mPin2State == PinState.PINSTATE_ENABLED_BLOCKED;
        }
    
public booleangetIccPuk2Blocked()

return
true if ICC card is PUK2 blocked

        synchronized (mLock) {
            return mPin2State == PinState.PINSTATE_ENABLED_PERM_BLOCKED;
        }
    
public IccRecordsgetIccRecords()

        synchronized (mLock) {
            return mIccRecords;
        }
    
public com.android.internal.telephony.uicc.IccCardApplicationStatus.PersoSubStategetPersoSubState()

        synchronized (mLock) {
            return mPersoSubState;
        }
    
public intgetPhoneId()

        return mUiccCard.getPhoneId();
    
public com.android.internal.telephony.uicc.IccCardStatus.PinStategetPin1State()

        synchronized (mLock) {
            if (mPin1Replaced) {
                return mUiccCard.getUniversalPinState();
            }
            return mPin1State;
        }
    
public com.android.internal.telephony.uicc.IccCardApplicationStatus.AppStategetState()

        synchronized (mLock) {
            return mAppState;
        }
    
public com.android.internal.telephony.uicc.IccCardApplicationStatus.AppTypegetType()

        synchronized (mLock) {
            return mAppType;
        }
    
protected UiccCardgetUiccCard()

        return mUiccCard;
    
private voidlog(java.lang.String msg)

        Rlog.d(LOG_TAG, msg);
    
private voidloge(java.lang.String msg)

        Rlog.e(LOG_TAG, msg);
    
private voidnotifyNetworkLockedRegistrantsIfNeeded(android.os.Registrant r)
Notifies specified registrant, assume mLock is held.

param
r Registrant to be notified. If null - all registrants will be notified

        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 voidnotifyPinLockedRegistrantsIfNeeded(android.os.Registrant r)
Notifies specified registrant, assume mLock is held.

param
r Registrant to be notified. If null - all registrants will be notified

        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 voidnotifyReadyRegistrantsIfNeeded(android.os.Registrant r)
Notifies specified registrant, assume mLock is held.

param
r Registrant to be notified. If null - all registrants will be notified

        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 voidonChangeFacilityLock(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 voidonChangeFdnDone(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 voidonQueryFacilityLock(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 voidonQueryFdnEnabled(android.os.AsyncResult ar)
Interpret EVENT_QUERY_FACILITY_LOCK_DONE

param
ar is asyncResult of Query_Facility_Locked

        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 intparsePinPukErrorResult(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;
        }
    
voidqueryFdn()
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 voidqueryPin1State()
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 voidregisterForLocked(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 voidregisterForNetworkLocked(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 voidregisterForReady(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 voidsetIccFdnEnabled(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

param
enabled "true" for locked "false" for unlocked.
param
password needed to change the ICC fdn enable, aka Pin2
param
onComplete onComplete.obj will be an AsyncResult ((AsyncResult)onComplete.obj).exception == null on success ((AsyncResult)onComplete.obj).exception != null on fail

        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 voidsetIccLockEnabled(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

param
enabled "true" for locked "false" for unlocked.
param
password needed to change the ICC pin state, aka. Pin1
param
onComplete onComplete.obj will be an AsyncResult ((AsyncResult)onComplete.obj).exception == null on success ((AsyncResult)onComplete.obj).exception != null on fail

        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 voidsupplyNetworkDepersonalization(java.lang.String pin, android.os.Message onComplete)

        synchronized (mLock) {
            if (DBG) log("supplyNetworkDepersonalization");
            mCi.supplyNetworkDepersonalization(pin, onComplete);
        }
    
public voidsupplyPin(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 voidsupplyPin2(java.lang.String pin2, android.os.Message onComplete)

        synchronized (mLock) {
            mCi.supplyIccPin2ForApp(pin2, mAid,
                    mHandler.obtainMessage(EVENT_PIN2_PUK2_DONE, onComplete));
        }
    
public voidsupplyPuk(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 voidsupplyPuk2(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 voidunregisterForLocked(android.os.Handler h)

        synchronized (mLock) {
            mPinLockedRegistrants.remove(h);
        }
    
public voidunregisterForNetworkLocked(android.os.Handler h)

        synchronized (mLock) {
            mNetworkLockedRegistrants.remove(h);
        }
    
public voidunregisterForReady(android.os.Handler h)

        synchronized (mLock) {
            mReadyRegistrants.remove(h);
        }
    
voidupdate(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);
            }
        }