Search in sources :

Example 36 with ImsCall

use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.

the class ImsPhoneCallTracker method holdActiveCallForWaitingCall.

/**
 * Hold the currently active call in order to answer the waiting call.
 */
public void holdActiveCallForWaitingCall() throws CallStateException {
    boolean switchingWithWaitingCall = !mBackgroundCall.getState().isAlive() && mRingingCall.getState() == ImsPhoneCall.State.WAITING;
    if (switchingWithWaitingCall) {
        ImsCall callToHold = mForegroundCall.getImsCall();
        HoldSwapState oldHoldState = mHoldSwitchingState;
        mHoldSwitchingState = HoldSwapState.HOLDING_TO_ANSWER_INCOMING;
        mForegroundCall.switchWith(mBackgroundCall);
        logHoldSwapState("holdActiveCallForWaitingCall");
        try {
            callToHold.hold();
            mMetrics.writeOnImsCommand(mPhone.getPhoneId(), callToHold.getSession(), ImsCommand.IMS_CMD_HOLD);
        } catch (ImsException e) {
            mForegroundCall.switchWith(mBackgroundCall);
            mHoldSwitchingState = oldHoldState;
            logHoldSwapState("holdActiveCallForWaitingCall - fail");
            throw new CallStateException(e.getMessage());
        }
    }
}
Also used : CallStateException(com.android.internal.telephony.CallStateException) ImsCall(com.android.ims.ImsCall) ImsException(com.android.ims.ImsException)

Example 37 with ImsCall

use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.

the class ImsPhoneConnection method updateImsCallRatFromExtras.

/**
 * Updates the IMS call rat based on the {@link ImsCallProfile#EXTRA_CALL_RAT_TYPE}.
 *
 * @param extras The ImsCallProfile extras.
 */
private void updateImsCallRatFromExtras(Bundle extras) {
    if (extras.containsKey(ImsCallProfile.EXTRA_CALL_NETWORK_TYPE) || extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE) || extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE_ALT)) {
        ImsCall call = getImsCall();
        int networkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        if (call != null) {
            networkType = call.getNetworkType();
        }
        // Report any changes for network type change
        setCallRadioTech(ServiceState.networkTypeToRilRadioTechnology(networkType));
    }
}
Also used : ImsCall(com.android.ims.ImsCall)

Example 38 with ImsCall

use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.

the class ImsPhoneConnection method startRtt.

/**
 * Send a RTT upgrade request to the remote party.
 * @param textStream RTT text stream to use
 */
public void startRtt(android.telecom.Connection.RttTextStream textStream) {
    ImsCall imsCall = getImsCall();
    if (imsCall != null) {
        getImsCall().sendRttModifyRequest(true);
        setCurrentRttTextStream(textStream);
    }
}
Also used : ImsCall(com.android.ims.ImsCall)

Example 39 with ImsCall

use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.

the class ImsPhoneCallTracker method answerWaitingCall.

private void answerWaitingCall() throws ImsException {
    // accept waiting call after holding background call
    ImsCall imsCall = mRingingCall.getImsCall();
    if (imsCall != null) {
        mPhone.getVoiceCallSessionStats().onImsAcceptCall(mRingingCall.getConnections());
        imsCall.accept(ImsCallProfile.getCallTypeFromVideoState(mPendingCallVideoState));
        mMetrics.writeOnImsCommand(mPhone.getPhoneId(), imsCall.getSession(), ImsCommand.IMS_CMD_ACCEPT);
    }
}
Also used : ImsCall(com.android.ims.ImsCall)

Example 40 with ImsCall

use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.

the class ImsPhoneCallTracker method holdActiveCall.

/**
 * Holds the active call, possibly resuming the already-held background call if it exists.
 */
public void holdActiveCall() throws CallStateException {
    if (mForegroundCall.getState() == ImsPhoneCall.State.ACTIVE) {
        if (mHoldSwitchingState == HoldSwapState.PENDING_SINGLE_CALL_HOLD || mHoldSwitchingState == HoldSwapState.SWAPPING_ACTIVE_AND_HELD) {
            logi("Ignoring hold request while already holding or swapping");
            return;
        }
        HoldSwapState oldHoldState = mHoldSwitchingState;
        ImsCall callToHold = mForegroundCall.getImsCall();
        if (mBackgroundCall.getState().isAlive()) {
            mCallExpectedToResume = mBackgroundCall.getImsCall();
            mHoldSwitchingState = HoldSwapState.SWAPPING_ACTIVE_AND_HELD;
        } else {
            mHoldSwitchingState = HoldSwapState.PENDING_SINGLE_CALL_HOLD;
        }
        logHoldSwapState("holdActiveCall");
        mForegroundCall.switchWith(mBackgroundCall);
        try {
            callToHold.hold();
            mMetrics.writeOnImsCommand(mPhone.getPhoneId(), callToHold.getSession(), ImsCommand.IMS_CMD_HOLD);
        } catch (ImsException e) {
            mForegroundCall.switchWith(mBackgroundCall);
            mHoldSwitchingState = oldHoldState;
            logHoldSwapState("holdActiveCall - fail");
            throw new CallStateException(e.getMessage());
        }
    }
}
Also used : CallStateException(com.android.internal.telephony.CallStateException) ImsCall(com.android.ims.ImsCall) ImsException(com.android.ims.ImsException)

Aggregations

ImsCall (com.android.ims.ImsCall)48 ImsException (com.android.ims.ImsException)19 SmallTest (android.test.suitebuilder.annotation.SmallTest)16 CallStateException (com.android.internal.telephony.CallStateException)16 TelephonyTest (com.android.internal.telephony.TelephonyTest)16 Test (org.junit.Test)16 ImsCallProfile (android.telephony.ims.ImsCallProfile)8 FlakyTest (androidx.test.filters.FlakyTest)8 RemoteException (android.os.RemoteException)6 Connection (com.android.internal.telephony.Connection)5 ImsPhoneCall (com.android.internal.telephony.imsphone.ImsPhoneCall)5 ImsPhone (com.android.internal.telephony.imsphone.ImsPhone)4 ImsReasonInfo (android.telephony.ims.ImsReasonInfo)3 ImsMultiEndpoint (com.android.ims.ImsMultiEndpoint)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 Bundle (android.os.Bundle)2 PersistableBundle (android.os.PersistableBundle)2 TestConferenceEventPackageParser (com.android.internal.telephony.test.TestConferenceEventPackageParser)2 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2