Search in sources :

Example 36 with UnsupportedAppUsage

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

the class ImsPhoneConnection 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 37 with UnsupportedAppUsage

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

the class GsmSMSDispatcher method sendSms.

/**
 * {@inheritDoc}
 */
@UnsupportedAppUsage
@Override
protected void sendSms(SmsTracker tracker) {
    int ss = mPhone.getServiceState().getState();
    Rlog.d(TAG, "sendSms: " + " isIms()=" + isIms() + " mRetryCount=" + tracker.mRetryCount + " mImsRetry=" + tracker.mImsRetry + " mMessageRef=" + tracker.mMessageRef + " mUsesImsServiceForIms=" + tracker.mUsesImsServiceForIms + " SS=" + ss + " id=" + tracker.mMessageId);
    // if sms over IMS is not supported on data and voice is not available...
    if (!isIms() && ss != ServiceState.STATE_IN_SERVICE) {
        // In 5G case only Data Rat is reported.
        if (mPhone.getServiceState().getRilDataRadioTechnology() != ServiceState.RIL_RADIO_TECHNOLOGY_NR) {
            tracker.onFailed(mContext, getNotInServiceError(ss), NO_ERROR_CODE);
            return;
        }
    }
    Message reply = obtainMessage(EVENT_SEND_SMS_COMPLETE, tracker);
    HashMap<String, Object> map = tracker.getData();
    byte[] pdu = (byte[]) map.get("pdu");
    byte[] smsc = (byte[]) map.get("smsc");
    if (tracker.mRetryCount > 0) {
        // and TP-MR is set to previously failed sms TP-MR
        if (((0x01 & pdu[0]) == 0x01)) {
            // TP-RD
            pdu[0] |= 0x04;
            // TP-MR
            pdu[1] = (byte) tracker.mMessageRef;
        }
    }
    // fall back to sending over CS.
    if (0 == tracker.mImsRetry && !isIms() || tracker.mUsesImsServiceForIms) {
        if (tracker.mRetryCount == 0 && tracker.mExpectMore) {
            mCi.sendSMSExpectMore(IccUtils.bytesToHexString(smsc), IccUtils.bytesToHexString(pdu), reply);
        } else {
            mCi.sendSMS(IccUtils.bytesToHexString(smsc), IccUtils.bytesToHexString(pdu), reply);
        }
    } else {
        mCi.sendImsGsmSms(IccUtils.bytesToHexString(smsc), IccUtils.bytesToHexString(pdu), tracker.mImsRetry, tracker.mMessageRef, reply);
        // increment it here, so in case of SMS_FAIL_RETRY over IMS
        // next retry will be sent using IMS request again.
        tracker.mImsRetry++;
    }
}
Also used : Message(android.os.Message) UnsupportedAppUsage(android.compat.annotation.UnsupportedAppUsage)

Example 38 with UnsupportedAppUsage

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

the class ImsPhone method setCallWaiting.

@UnsupportedAppUsage
@Override
public void setCallWaiting(boolean enable, Message onComplete) {
    int serviceClass = CommandsInterface.SERVICE_CLASS_VOICE;
    CarrierConfigManager configManager = (CarrierConfigManager) getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
    PersistableBundle b = configManager.getConfigForSubId(getSubId());
    if (b != null) {
        serviceClass = b.getInt(CarrierConfigManager.KEY_CALL_WAITING_SERVICE_CLASS_INT, CommandsInterface.SERVICE_CLASS_VOICE);
    }
    setCallWaiting(enable, serviceClass, onComplete);
}
Also used : CarrierConfigManager(android.telephony.CarrierConfigManager) PersistableBundle(android.os.PersistableBundle) UnsupportedAppUsage(android.compat.annotation.UnsupportedAppUsage)

Example 39 with UnsupportedAppUsage

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

the class ImsPhone method onMMIDone.

/**
 * Removes the given MMI from the pending list and notifies
 * registrants that it is complete.
 * @param mmi MMI that is done
 */
@UnsupportedAppUsage
public void onMMIDone(ImsPhoneMmiCode mmi) {
    /* Only notify complete if it's on the pending list.
         * Otherwise, it's already been handled (eg, previously canceled).
         * The exception is cancellation of an incoming USSD-REQUEST, which is
         * not on the list.
         */
    logd("onMMIDone: mmi=" + mmi);
    if (mPendingMMIs.remove(mmi) || mmi.isUssdRequest() || mmi.isSsInfo()) {
        ResultReceiver receiverCallback = mmi.getUssdCallbackReceiver();
        if (receiverCallback != null) {
            int returnCode = (mmi.getState() == MmiCode.State.COMPLETE) ? TelephonyManager.USSD_RETURN_SUCCESS : TelephonyManager.USSD_RETURN_FAILURE;
            sendUssdResponse(mmi.getDialString(), mmi.getMessage(), returnCode, receiverCallback);
        } else {
            logv("onMMIDone: notifyRegistrants");
            mMmiCompleteRegistrants.notifyRegistrants(new AsyncResult(null, mmi, null));
        }
    }
}
Also used : AsyncResult(android.os.AsyncResult) ResultReceiver(android.os.ResultReceiver) UnsupportedAppUsage(android.compat.annotation.UnsupportedAppUsage)

Example 40 with UnsupportedAppUsage

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

the class ImsPhoneCall method onHangupLocal.

// ***** Called from ImsPhoneCallTracker
/**
 * Called when this Call is being hung up locally (eg, user pressed "end")
 */
@UnsupportedAppUsage
@VisibleForTesting
public void onHangupLocal() {
    ArrayList<Connection> connections = getConnections();
    for (Connection conn : connections) {
        ImsPhoneConnection imsConn = (ImsPhoneConnection) conn;
        imsConn.onHangupLocal();
    }
    synchronized (this) {
        if (mState.isAlive()) {
            mState = State.DISCONNECTING;
        }
    }
    if (VDBG) {
        Rlog.v(LOG_TAG, "onHangupLocal : " + mCallContext + " state = " + mState);
    }
}
Also used : Connection(com.android.internal.telephony.Connection) VisibleForTesting(com.android.internal.annotations.VisibleForTesting) 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