Search in sources :

Example 1 with UnsupportedAppUsage

use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.

the class GsmCdmaCallTracker method updatePhoneState.

@UnsupportedAppUsage
private void updatePhoneState() {
    PhoneConstants.State oldState = mState;
    if (mRingingCall.isRinging()) {
        mState = PhoneConstants.State.RINGING;
    } else if (mPendingMO != null || !(mForegroundCall.isIdle() && mBackgroundCall.isIdle())) {
        mState = PhoneConstants.State.OFFHOOK;
    } else {
        Phone imsPhone = mPhone.getImsPhone();
        if (mState == PhoneConstants.State.OFFHOOK && (imsPhone != null)) {
            imsPhone.callEndCleanupHandOverCallIfAny();
        }
        mState = PhoneConstants.State.IDLE;
    }
    if (mState == PhoneConstants.State.IDLE && oldState != mState) {
        mVoiceCallEndedRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
    } else if (oldState == PhoneConstants.State.IDLE && oldState != mState) {
        mVoiceCallStartedRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
    }
    if (Phone.DEBUG_PHONE) {
        log("update phone state, old=" + oldState + " new=" + mState);
    }
    if (mState != oldState) {
        mPhone.notifyPhoneStateChanged();
        mMetrics.writePhoneState(mPhone.getPhoneId(), mState);
    }
}
Also used : AsyncResult(android.os.AsyncResult) UnsupportedAppUsage(android.compat.annotation.UnsupportedAppUsage)

Example 2 with UnsupportedAppUsage

use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.

the class GsmCdmaConnection method createWakeLock.

@UnsupportedAppUsage
private void createWakeLock(Context context) {
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    mPartialWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG);
}
Also used : PowerManager(android.os.PowerManager) UnsupportedAppUsage(android.compat.annotation.UnsupportedAppUsage)

Example 3 with UnsupportedAppUsage

use of android.compat.annotation.UnsupportedAppUsage 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 4 with UnsupportedAppUsage

use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.

the class CallManager method getActiveFgCall.

@UnsupportedAppUsage
public Call getActiveFgCall(int subId) {
    Call call = getFirstNonIdleCall(mForegroundCalls, subId);
    if (call == null) {
        Phone phone = getPhone(subId);
        call = (phone == null) ? null : phone.getForegroundCall();
    }
    return call;
}
Also used : SipPhone(com.android.internal.telephony.sip.SipPhone) UnsupportedAppUsage(android.compat.annotation.UnsupportedAppUsage)

Example 5 with UnsupportedAppUsage

use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.

the class SubscriptionController method notifySubscriptionInfoChanged.

/**
 * Notify the changed of subscription info.
 */
@UnsupportedAppUsage
public void notifySubscriptionInfoChanged() {
    TelephonyRegistryManager trm = (TelephonyRegistryManager) mContext.getSystemService(Context.TELEPHONY_REGISTRY_SERVICE);
    if (DBG)
        logd("notifySubscriptionInfoChanged:");
    trm.notifySubscriptionInfoChanged();
    // FIXME: Remove if listener technique accepted.
    broadcastSimInfoContentChanged();
    MultiSimSettingController.getInstance().notifySubscriptionInfoChanged();
    TelephonyMetrics metrics = TelephonyMetrics.getInstance();
    List<SubscriptionInfo> subInfos;
    synchronized (mSubInfoListLock) {
        subInfos = new ArrayList<>(mCacheActiveSubInfoList);
    }
    if (mOpptSubInfoListChangedDirtyBit.getAndSet(false)) {
        notifyOpportunisticSubscriptionInfoChanged();
    }
    metrics.updateActiveSubscriptionInfoList(subInfos);
}
Also used : SubscriptionInfo(android.telephony.SubscriptionInfo) TelephonyMetrics(com.android.internal.telephony.metrics.TelephonyMetrics) TelephonyRegistryManager(android.telephony.TelephonyRegistryManager) UnsupportedAppUsage(android.compat.annotation.UnsupportedAppUsage)

Aggregations

UnsupportedAppUsage (android.compat.annotation.UnsupportedAppUsage)71 Message (android.os.Message)18 SmsMessage (android.telephony.SmsMessage)9 Intent (android.content.Intent)6 SipPhone (com.android.internal.telephony.sip.SipPhone)6 SmsCbMessage (android.telephony.SmsCbMessage)5 Cursor (android.database.Cursor)4 PendingIntent (android.app.PendingIntent)3 PackageManager (android.content.pm.PackageManager)3 AsyncResult (android.os.AsyncResult)3 PersistableBundle (android.os.PersistableBundle)3 CarrierConfigManager (android.telephony.CarrierConfigManager)3 SubscriptionInfo (android.telephony.SubscriptionInfo)3 SQLException (android.database.SQLException)2 SQLiteException (android.database.sqlite.SQLiteException)2 PowerManager (android.os.PowerManager)2 RadioAccessFamily (android.telephony.RadioAccessFamily)2 ImsException (com.android.ims.ImsException)2 ImsUtInterface (com.android.ims.ImsUtInterface)2 AppState (com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState)2