Search in sources :

Example 1 with AppState

use of com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState in project android_frameworks_opt_telephony by LineageOS.

the class GsmCdmaConnection method disconnectCauseFromCode.

/**
 * Maps RIL call disconnect code to {@link DisconnectCause}.
 * @param causeCode RIL disconnect code
 * @return the corresponding value from {@link DisconnectCause}
 */
@UnsupportedAppUsage
int disconnectCauseFromCode(int causeCode) {
    switch(causeCode) {
        case CallFailCause.USER_BUSY:
            return DisconnectCause.BUSY;
        case CallFailCause.NO_CIRCUIT_AVAIL:
        case CallFailCause.TEMPORARY_FAILURE:
        case CallFailCause.SWITCHING_CONGESTION:
        case CallFailCause.CHANNEL_NOT_AVAIL:
        case CallFailCause.QOS_NOT_AVAIL:
        case CallFailCause.BEARER_NOT_AVAIL:
            return DisconnectCause.CONGESTION;
        case CallFailCause.EMERGENCY_TEMP_FAILURE:
            return DisconnectCause.EMERGENCY_TEMP_FAILURE;
        case CallFailCause.EMERGENCY_PERM_FAILURE:
            return DisconnectCause.EMERGENCY_PERM_FAILURE;
        case CallFailCause.ACM_LIMIT_EXCEEDED:
            return DisconnectCause.LIMIT_EXCEEDED;
        case CallFailCause.OPERATOR_DETERMINED_BARRING:
        case CallFailCause.CALL_BARRED:
            return DisconnectCause.CALL_BARRED;
        case CallFailCause.FDN_BLOCKED:
            return DisconnectCause.FDN_BLOCKED;
        case CallFailCause.IMEI_NOT_ACCEPTED:
            return DisconnectCause.IMEI_NOT_ACCEPTED;
        case CallFailCause.UNOBTAINABLE_NUMBER:
            return DisconnectCause.UNOBTAINABLE_NUMBER;
        case CallFailCause.DIAL_MODIFIED_TO_USSD:
            return DisconnectCause.DIAL_MODIFIED_TO_USSD;
        case CallFailCause.DIAL_MODIFIED_TO_SS:
            return DisconnectCause.DIAL_MODIFIED_TO_SS;
        case CallFailCause.DIAL_MODIFIED_TO_DIAL:
            return DisconnectCause.DIAL_MODIFIED_TO_DIAL;
        case CallFailCause.CDMA_LOCKED_UNTIL_POWER_CYCLE:
            return DisconnectCause.CDMA_LOCKED_UNTIL_POWER_CYCLE;
        case CallFailCause.CDMA_DROP:
            return DisconnectCause.CDMA_DROP;
        case CallFailCause.CDMA_INTERCEPT:
            return DisconnectCause.CDMA_INTERCEPT;
        case CallFailCause.CDMA_REORDER:
            return DisconnectCause.CDMA_REORDER;
        case CallFailCause.CDMA_SO_REJECT:
            return DisconnectCause.CDMA_SO_REJECT;
        case CallFailCause.CDMA_RETRY_ORDER:
            return DisconnectCause.CDMA_RETRY_ORDER;
        case CallFailCause.CDMA_ACCESS_FAILURE:
            return DisconnectCause.CDMA_ACCESS_FAILURE;
        case CallFailCause.CDMA_PREEMPTED:
            return DisconnectCause.CDMA_PREEMPTED;
        case CallFailCause.CDMA_NOT_EMERGENCY:
            return DisconnectCause.CDMA_NOT_EMERGENCY;
        case CallFailCause.CDMA_ACCESS_BLOCKED:
            return DisconnectCause.CDMA_ACCESS_BLOCKED;
        case CallFailCause.NORMAL_UNSPECIFIED:
            return DisconnectCause.NORMAL_UNSPECIFIED;
        case CallFailCause.USER_ALERTING_NO_ANSWER:
            return DisconnectCause.TIMED_OUT;
        case CallFailCause.ACCESS_CLASS_BLOCKED:
        case CallFailCause.ERROR_UNSPECIFIED:
        case CallFailCause.NORMAL_CLEARING:
        default:
            GsmCdmaPhone phone = mOwner.getPhone();
            int serviceState = phone.getServiceState().getState();
            UiccCardApplication cardApp = phone.getUiccCardApplication();
            AppState uiccAppState = (cardApp != null) ? cardApp.getState() : AppState.APPSTATE_UNKNOWN;
            if (serviceState == ServiceState.STATE_POWER_OFF) {
                return DisconnectCause.POWER_OFF;
            }
            if (!isEmergencyCall()) {
                // an OUT_OF_SERVICE disconnect cause during normal call ending.
                if ((serviceState == ServiceState.STATE_OUT_OF_SERVICE || serviceState == ServiceState.STATE_EMERGENCY_ONLY)) {
                    return DisconnectCause.OUT_OF_SERVICE;
                }
                // locked the AppState will always not be equal to APPSTATE_READY.
                if (uiccAppState != AppState.APPSTATE_READY) {
                    if (isPhoneTypeGsm()) {
                        return DisconnectCause.ICC_ERROR;
                    } else {
                        // CDMA
                        if (phone.mCdmaSubscriptionSource == CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_RUIM) {
                            return DisconnectCause.ICC_ERROR;
                        }
                    }
                }
            }
            if (isPhoneTypeGsm()) {
                if (causeCode == CallFailCause.ERROR_UNSPECIFIED || causeCode == CallFailCause.ACCESS_CLASS_BLOCKED) {
                    if (phone.mSST.mRestrictedState.isCsRestricted()) {
                        return DisconnectCause.CS_RESTRICTED;
                    } else if (phone.mSST.mRestrictedState.isCsEmergencyRestricted()) {
                        return DisconnectCause.CS_RESTRICTED_EMERGENCY;
                    } else if (phone.mSST.mRestrictedState.isCsNormalRestricted()) {
                        return DisconnectCause.CS_RESTRICTED_NORMAL;
                    }
                }
            }
            if (causeCode == CallFailCause.NORMAL_CLEARING) {
                return DisconnectCause.NORMAL;
            }
            // to app, not NORMAL call end.
            return DisconnectCause.ERROR_UNSPECIFIED;
    }
}
Also used : AppState(com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState) UiccCardApplication(com.android.internal.telephony.uicc.UiccCardApplication) UnsupportedAppUsage(android.compat.annotation.UnsupportedAppUsage)

Example 2 with AppState

use of com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState in project android_frameworks_opt_telephony by LineageOS.

the class UiccCardApplication method update.

@UnsupportedAppUsage
public void update(IccCardApplicationStatus as, Context c, 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;
        PinState oldPin1State = mPin1State;
        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 && PersoSubState.isPersoLocked(mPersoSubState)) {
            notifyNetworkLockedRegistrantsIfNeeded(null);
        }
        if (mAppState != oldAppState) {
            if (DBG)
                log(oldAppType + " changed state: " + oldAppState + " -> " + mAppState);
            // as it might have failed in earlier attempt.
            if (mAppState == AppState.APPSTATE_READY) {
                queryFdn();
                queryPin1State();
            }
            notifyPinLockedRegistrantsIfNeeded(null);
            notifyReadyRegistrantsIfNeeded(null);
            notifyDetectedRegistrantsIfNeeded(null);
        } else {
            if (mPin1State != oldPin1State)
                queryPin1State();
        }
    }
}
Also used : PinState(com.android.internal.telephony.uicc.IccCardStatus.PinState) AppState(com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState) AppType(com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType) PersoSubState(com.android.internal.telephony.uicc.IccCardApplicationStatus.PersoSubState) UnsupportedAppUsage(android.compat.annotation.UnsupportedAppUsage)

Example 3 with AppState

use of com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState in project android_frameworks_opt_telephony by LineageOS.

the class IccCardProxy method processLockedState.

private void processLockedState() {
    synchronized (mLock) {
        if (mUiccApplication == null) {
            // Don't need to do anything if non-existent application is locked
            return;
        }
        PinState pin1State = mUiccApplication.getPin1State();
        if (pin1State == PinState.PINSTATE_ENABLED_PERM_BLOCKED) {
            setExternalState(State.PERM_DISABLED);
            return;
        }
        AppState appState = mUiccApplication.getState();
        switch(appState) {
            case APPSTATE_PIN:
                mPinLockedRegistrants.notifyRegistrants();
                setExternalState(State.PIN_REQUIRED);
                break;
            case APPSTATE_PUK:
                setExternalState(State.PUK_REQUIRED);
                break;
            case APPSTATE_DETECTED:
            case APPSTATE_READY:
            case APPSTATE_SUBSCRIPTION_PERSO:
            case APPSTATE_UNKNOWN:
                // Neither required
                break;
        }
    }
}
Also used : PinState(com.android.internal.telephony.uicc.IccCardStatus.PinState) AppState(com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState)

Aggregations

AppState (com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState)3 UnsupportedAppUsage (android.compat.annotation.UnsupportedAppUsage)2 PinState (com.android.internal.telephony.uicc.IccCardStatus.PinState)2 AppType (com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType)1 PersoSubState (com.android.internal.telephony.uicc.IccCardApplicationStatus.PersoSubState)1 UiccCardApplication (com.android.internal.telephony.uicc.UiccCardApplication)1