Search in sources :

Example 1 with ImsCall

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

the class TelephonyTester method handleTestConferenceEventPackage.

/**
 * Handles request to send a test conference event package to the active Ims call.
 *
 * @see com.android.internal.telephony.test.TestConferenceEventPackageParser
 * @param context The context.
 * @param fileName The name of the test conference event package file to read.
 */
private void handleTestConferenceEventPackage(Context context, String fileName) {
    // Attempt to get the active IMS call before parsing the test XML file.
    ImsPhone imsPhone = (ImsPhone) mPhone;
    if (imsPhone == null) {
        return;
    }
    ImsPhoneCall imsPhoneCall = imsPhone.getForegroundCall();
    if (imsPhoneCall == null) {
        return;
    }
    ImsCall imsCall = imsPhoneCall.getImsCall();
    if (imsCall == null) {
        return;
    }
    File packageFile = new File(context.getFilesDir(), fileName);
    final FileInputStream is;
    try {
        is = new FileInputStream(packageFile);
    } catch (FileNotFoundException ex) {
        log("Test conference event package file not found: " + packageFile.getAbsolutePath());
        return;
    }
    TestConferenceEventPackageParser parser = new TestConferenceEventPackageParser(is);
    ImsConferenceState imsConferenceState = parser.parse();
    if (imsConferenceState == null) {
        return;
    }
    imsCall.conferenceStateUpdated(imsConferenceState);
}
Also used : TestConferenceEventPackageParser(com.android.internal.telephony.test.TestConferenceEventPackageParser) ImsCall(com.android.ims.ImsCall) ImsPhoneCall(com.android.internal.telephony.imsphone.ImsPhoneCall) FileNotFoundException(java.io.FileNotFoundException) ImsPhone(com.android.internal.telephony.imsphone.ImsPhone) File(java.io.File) FileInputStream(java.io.FileInputStream) ImsConferenceState(com.android.ims.ImsConferenceState)

Example 2 with ImsCall

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

the class ImsPhoneCallTracker method switchWaitingOrHoldingAndActive.

public void switchWaitingOrHoldingAndActive() throws CallStateException {
    if (DBG)
        log("switchWaitingOrHoldingAndActive");
    if (mRingingCall.getState() == ImsPhoneCall.State.INCOMING) {
        throw new CallStateException("cannot be in the incoming state");
    }
    if (mForegroundCall.getState() == ImsPhoneCall.State.ACTIVE) {
        ImsCall imsCall = mForegroundCall.getImsCall();
        if (imsCall == null) {
            throw new CallStateException("no ims call");
        }
        // Swap the ImsCalls pointed to by the foreground and background ImsPhoneCalls.
        // If hold or resume later fails, we will swap them back.
        boolean switchingWithWaitingCall = !mBackgroundCall.getState().isAlive() && mRingingCall != null && mRingingCall.getState() == ImsPhoneCall.State.WAITING;
        mSwitchingFgAndBgCalls = true;
        if (switchingWithWaitingCall) {
            mCallExpectedToResume = mRingingCall.getImsCall();
        } else {
            mCallExpectedToResume = mBackgroundCall.getImsCall();
        }
        mForegroundCall.switchWith(mBackgroundCall);
        // be resumed.
        try {
            imsCall.hold();
            mMetrics.writeOnImsCommand(mPhone.getPhoneId(), imsCall.getSession(), ImsCommand.IMS_CMD_HOLD);
            // If there is no background call to resume, then don't expect there to be a switch.
            if (mCallExpectedToResume == null) {
                log("mCallExpectedToResume is null");
                mSwitchingFgAndBgCalls = false;
            }
        } catch (ImsException e) {
            mForegroundCall.switchWith(mBackgroundCall);
            throw new CallStateException(e.getMessage());
        }
    } else if (mBackgroundCall.getState() == ImsPhoneCall.State.HOLDING) {
        resumeWaitingOrHolding();
    }
}
Also used : CallStateException(com.android.internal.telephony.CallStateException) ImsCall(com.android.ims.ImsCall) ImsException(com.android.ims.ImsException)

Example 3 with ImsCall

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

the class ImsPhoneCallTracker method handleDataEnabledChange.

/**
 * Handles changes to the enabled state of mobile data.
 * When data is disabled, handles auto-downgrade of video calls over LTE.
 * When data is enabled, handled resuming of video calls paused when data was disabled.
 * @param enabled {@code true} if mobile data is enabled, {@code false} if mobile data is
 *                            disabled.
 * @param reasonCode The {@link ImsReasonInfo} code for the data enabled state change.
 */
private void handleDataEnabledChange(boolean enabled, int reasonCode) {
    if (!enabled) {
        // data charges.
        for (ImsPhoneConnection conn : mConnections) {
            ImsCall imsCall = conn.getImsCall();
            if (imsCall != null && imsCall.isVideoCall() && !imsCall.isWifiCall()) {
                log("handleDataEnabledChange - downgrading " + conn);
                downgradeVideoCall(reasonCode, conn);
            }
        }
    } else if (mSupportPauseVideo) {
        // Data was re-enabled, so un-pause previously paused video calls.
        for (ImsPhoneConnection conn : mConnections) {
            // If video is paused, check to see if there are any pending pauses due to enabled
            // state of data changing.
            log("handleDataEnabledChange - resuming " + conn);
            if (VideoProfile.isPaused(conn.getVideoState()) && conn.wasVideoPausedFromSource(VideoPauseTracker.SOURCE_DATA_ENABLED)) {
                // The data enabled state was a cause of a pending pause, so potentially
                // resume the video now.
                conn.resumeVideo(VideoPauseTracker.SOURCE_DATA_ENABLED);
            }
        }
        mShouldUpdateImsConfigOnDisconnect = false;
    }
}
Also used : ImsCall(com.android.ims.ImsCall)

Example 4 with ImsCall

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

the class ImsPhoneConnection method sendRttModifyResponse.

/**
 * Sends the user's response to a remotely-issued RTT upgrade request
 *
 * @param textStream A valid {@link android.telecom.Connection.RttTextStream} if the user
 *                   accepts, {@code null} if not.
 */
public void sendRttModifyResponse(android.telecom.Connection.RttTextStream textStream) {
    boolean accept = textStream != null;
    ImsCall imsCall = getImsCall();
    imsCall.sendRttModifyResponse(accept);
    if (accept) {
        setCurrentRttTextStream(textStream);
        startRttTextProcessing();
    } else {
        Rlog.e(LOG_TAG, "sendRttModifyResponse: foreground call has no connections");
    }
}
Also used : ImsCall(com.android.ims.ImsCall)

Example 5 with ImsCall

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

the class ImsCallTest method testSetWifi.

@Test
@SmallTest
public void testSetWifi() {
    ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile);
    assertFalse(mTestImsCall.isWifiCall());
    mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE, ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN + "");
    assertTrue(mTestImsCall.isWifiCall());
}
Also used : ImsCall(com.android.ims.ImsCall) SmallTest(android.test.suitebuilder.annotation.SmallTest) TelephonyTest(com.android.internal.telephony.TelephonyTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

ImsCall (com.android.ims.ImsCall)17 ImsException (com.android.ims.ImsException)7 CallStateException (com.android.internal.telephony.CallStateException)5 SmallTest (android.test.suitebuilder.annotation.SmallTest)4 TelephonyTest (com.android.internal.telephony.TelephonyTest)4 Test (org.junit.Test)4 ImsPhoneCall (com.android.internal.telephony.imsphone.ImsPhoneCall)3 ImsPhone (com.android.internal.telephony.imsphone.ImsPhone)2 AsyncResult (android.os.AsyncResult)1 RemoteException (android.os.RemoteException)1 Pair (android.util.Pair)1 ImsCallProfile (com.android.ims.ImsCallProfile)1 ImsConferenceState (com.android.ims.ImsConferenceState)1 ImsMultiEndpoint (com.android.ims.ImsMultiEndpoint)1 ImsReasonInfo (com.android.ims.ImsReasonInfo)1 SomeArgs (com.android.internal.os.SomeArgs)1 TestConferenceEventPackageParser (com.android.internal.telephony.test.TestConferenceEventPackageParser)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1