Search in sources :

Example 1 with UiccCardApplication

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

the class CatService method update.

public void update(CommandsInterface ci, Context context, UiccCard ic) {
    UiccCardApplication ca = null;
    IccRecords ir = null;
    if (ic != null) {
        /* Since Cat is not tied to any application, but rather is Uicc application
             * in itself - just get first FileHandler and IccRecords object
             */
        ca = ic.getApplicationIndex(0);
        if (ca != null) {
            ir = ca.getIccRecords();
        }
    }
    synchronized (sInstanceLock) {
        if ((ir != null) && (mIccRecords != ir)) {
            if (mIccRecords != null) {
                mIccRecords.unregisterForRecordsLoaded(this);
            }
            CatLog.d(this, "Reinitialize the Service with SIMRecords and UiccCardApplication");
            mIccRecords = ir;
            mUiccApplication = ca;
            // re-Register for SIM ready event.
            mIccRecords.registerForRecordsLoaded(this, MSG_ID_ICC_RECORDS_LOADED, null);
            CatLog.d(this, "registerForRecordsLoaded slotid=" + mSlotId + " instance:" + this);
        }
    }
}
Also used : IccRecords(com.android.internal.telephony.uicc.IccRecords) UiccCardApplication(com.android.internal.telephony.uicc.UiccCardApplication)

Example 2 with UiccCardApplication

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

the class PhoneSubInfoController method getIccSimChallengeResponse.

public String getIccSimChallengeResponse(int subId, int appType, int authType, String data) throws RemoteException {
    Phone phone = getPhone(subId);
    enforcePrivilegedPermissionOrCarrierPrivilege(phone);
    UiccCard uiccCard = phone.getUiccCard();
    if (uiccCard == null) {
        loge("getIccSimChallengeResponse() UiccCard is null");
        return null;
    }
    UiccCardApplication uiccApp = uiccCard.getApplicationByType(appType);
    if (uiccApp == null) {
        loge("getIccSimChallengeResponse() no app with specified type -- " + appType);
        return null;
    } else {
        loge("getIccSimChallengeResponse() found app " + uiccApp.getAid() + " specified type -- " + appType);
    }
    if (authType != UiccCardApplication.AUTH_CONTEXT_EAP_SIM && authType != UiccCardApplication.AUTH_CONTEXT_EAP_AKA) {
        loge("getIccSimChallengeResponse() unsupported authType: " + authType);
        return null;
    }
    return uiccApp.getIccRecords().getIccSimChallengeResponse(authType, data);
}
Also used : UiccCard(com.android.internal.telephony.uicc.UiccCard) UiccCardApplication(com.android.internal.telephony.uicc.UiccCardApplication)

Example 3 with UiccCardApplication

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

the class GsmCdmaPhone method getOperatorNumeric.

@Override
@NonNull
public String getOperatorNumeric() {
    String operatorNumeric = null;
    if (isPhoneTypeGsm()) {
        IccRecords r = mIccRecords.get();
        if (r != null) {
            operatorNumeric = r.getOperatorNumeric();
        }
    } else {
        // isPhoneTypeCdmaLte()
        IccRecords curIccRecords = null;
        if (mCdmaSubscriptionSource == CDMA_SUBSCRIPTION_NV) {
            operatorNumeric = SystemProperties.get("ro.cdma.home.operator.numeric");
        } else if (mCdmaSubscriptionSource == CDMA_SUBSCRIPTION_RUIM_SIM) {
            UiccCardApplication uiccCardApplication = mUiccApplication.get();
            if (uiccCardApplication != null && uiccCardApplication.getType() == AppType.APPTYPE_RUIM) {
                logd("Legacy RUIM app present");
                curIccRecords = mIccRecords.get();
            } else {
                // Use sim-records for SimApp, USimApp, CSimApp and ISimApp.
                curIccRecords = mSimRecords;
            }
            if (curIccRecords != null && curIccRecords == mSimRecords) {
                operatorNumeric = curIccRecords.getOperatorNumeric();
            } else {
                curIccRecords = mIccRecords.get();
                if (curIccRecords != null && (curIccRecords instanceof RuimRecords)) {
                    RuimRecords csim = (RuimRecords) curIccRecords;
                    operatorNumeric = csim.getRUIMOperatorNumeric();
                }
            }
        }
        if (operatorNumeric == null) {
            loge("getOperatorNumeric: Cannot retrieve operatorNumeric:" + " mCdmaSubscriptionSource = " + mCdmaSubscriptionSource + " mIccRecords = " + ((curIccRecords != null) ? curIccRecords.getRecordsLoaded() : null));
        }
        logd("getOperatorNumeric: mCdmaSubscriptionSource = " + mCdmaSubscriptionSource + " operatorNumeric = " + operatorNumeric);
    }
    return TextUtils.emptyIfNull(operatorNumeric);
}
Also used : IccRecords(com.android.internal.telephony.uicc.IccRecords) RuimRecords(com.android.internal.telephony.uicc.RuimRecords) UiccCardApplication(com.android.internal.telephony.uicc.UiccCardApplication) NonNull(android.annotation.NonNull)

Example 4 with UiccCardApplication

use of com.android.internal.telephony.uicc.UiccCardApplication 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 5 with UiccCardApplication

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

the class GsmCdmaPhone method getLteOnCdmaMode.

@Override
public int getLteOnCdmaMode() {
    int currentConfig = super.getLteOnCdmaMode();
    int lteOnCdmaModeDynamicValue = currentConfig;
    UiccCardApplication cdmaApplication = mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP2);
    if (cdmaApplication != null && cdmaApplication.getType() == AppType.APPTYPE_RUIM) {
        // Legacy RUIM cards don't support LTE.
        lteOnCdmaModeDynamicValue = RILConstants.LTE_ON_CDMA_FALSE;
        // Override only if static configuration is TRUE.
        if (currentConfig == RILConstants.LTE_ON_CDMA_TRUE) {
            return lteOnCdmaModeDynamicValue;
        }
    }
    return currentConfig;
}
Also used : UiccCardApplication(com.android.internal.telephony.uicc.UiccCardApplication)

Aggregations

UiccCardApplication (com.android.internal.telephony.uicc.UiccCardApplication)14 IccRecords (com.android.internal.telephony.uicc.IccRecords)6 IccFileHandler (com.android.internal.telephony.uicc.IccFileHandler)3 SIMRecords (com.android.internal.telephony.uicc.SIMRecords)3 UnsupportedAppUsage (android.compat.annotation.UnsupportedAppUsage)2 RuimRecords (com.android.internal.telephony.uicc.RuimRecords)2 NonNull (android.annotation.NonNull)1 CarrierConfigManager (android.telephony.CarrierConfigManager)1 CarrierDisplayNameResolver (com.android.internal.telephony.cdnr.CarrierDisplayNameResolver)1 AppState (com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState)1 IsimUiccRecords (com.android.internal.telephony.uicc.IsimUiccRecords)1 UiccCard (com.android.internal.telephony.uicc.UiccCard)1 Before (org.junit.Before)1