Search in sources :

Example 11 with ImsCall

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

the class ImsPhoneCallTracker method conference.

public void conference() {
    ImsCall fgImsCall = mForegroundCall.getImsCall();
    if (fgImsCall == null) {
        log("conference no foreground ims call");
        return;
    }
    ImsCall bgImsCall = mBackgroundCall.getImsCall();
    if (bgImsCall == null) {
        log("conference no background ims call");
        return;
    }
    if (fgImsCall.isCallSessionMergePending()) {
        log("conference: skip; foreground call already in process of merging.");
        return;
    }
    if (bgImsCall.isCallSessionMergePending()) {
        log("conference: skip; background call already in process of merging.");
        return;
    }
    // Keep track of the connect time of the earliest call so that it can be set on the
    // {@code ImsConference} when it is created.
    long foregroundConnectTime = mForegroundCall.getEarliestConnectTime();
    long backgroundConnectTime = mBackgroundCall.getEarliestConnectTime();
    long conferenceConnectTime;
    if (foregroundConnectTime > 0 && backgroundConnectTime > 0) {
        conferenceConnectTime = Math.min(mForegroundCall.getEarliestConnectTime(), mBackgroundCall.getEarliestConnectTime());
        log("conference - using connect time = " + conferenceConnectTime);
    } else if (foregroundConnectTime > 0) {
        log("conference - bg call connect time is 0; using fg = " + foregroundConnectTime);
        conferenceConnectTime = foregroundConnectTime;
    } else {
        log("conference - fg call connect time is 0; using bg = " + backgroundConnectTime);
        conferenceConnectTime = backgroundConnectTime;
    }
    String foregroundId = "";
    ImsPhoneConnection foregroundConnection = mForegroundCall.getFirstConnection();
    if (foregroundConnection != null) {
        foregroundConnection.setConferenceConnectTime(conferenceConnectTime);
        foregroundConnection.handleMergeStart();
        foregroundId = foregroundConnection.getTelecomCallId();
        cacheConnectionTimeWithPhoneNumber(foregroundConnection);
    }
    String backgroundId = "";
    ImsPhoneConnection backgroundConnection = findConnection(bgImsCall);
    if (backgroundConnection != null) {
        backgroundConnection.handleMergeStart();
        backgroundId = backgroundConnection.getTelecomCallId();
        cacheConnectionTimeWithPhoneNumber(backgroundConnection);
    }
    log("conference: fgCallId=" + foregroundId + ", bgCallId=" + backgroundId);
    mOperationLocalLog.log("conference: fgCallId=" + foregroundId + ", bgCallId=" + backgroundId);
    try {
        fgImsCall.merge(bgImsCall);
    } catch (ImsException e) {
        log("conference " + e.getMessage());
        handleConferenceFailed(foregroundConnection, backgroundConnection);
    }
}
Also used : ImsCall(com.android.ims.ImsCall) ImsException(com.android.ims.ImsException)

Example 12 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();
    if (imsCall != null) {
        imsCall.sendRttModifyResponse(accept);
        if (accept) {
            setCurrentRttTextStream(textStream);
        } else {
            Rlog.e(LOG_TAG, "sendRttModifyResponse: foreground call has no connections");
        }
    }
}
Also used : ImsCall(com.android.ims.ImsCall)

Example 13 with ImsCall

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

the class ImsPhoneCall method setMute.

/**
 * Sets the mute state of the call.
 * @param mute {@code true} if the call could be muted; {@code false} otherwise.
 */
@VisibleForTesting
public void setMute(boolean mute) {
    ImsPhoneConnection connection = getFirstConnection();
    ImsCall imsCall = connection == null ? null : connection.getImsCall();
    if (imsCall != null) {
        try {
            imsCall.setMute(mute);
        } catch (ImsException e) {
            Rlog.e(LOG_TAG, "setMute failed : " + e.getMessage());
        }
    }
}
Also used : ImsCall(com.android.ims.ImsCall) ImsException(com.android.ims.ImsException) VisibleForTesting(com.android.internal.annotations.VisibleForTesting)

Example 14 with ImsCall

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

the class Phone method isVideoCallOrConference.

/**
 * Determines if the specified call currently is or was at some point a video call, or if it is
 * a conference call.
 * @param call The call.
 * @return {@code true} if the call is or was a video call or is a conference call,
 *      {@code false} otherwise.
 */
private boolean isVideoCallOrConference(Call call) {
    if (call.isMultiparty()) {
        return true;
    }
    boolean isDowngradedVideoCall = false;
    if (call instanceof ImsPhoneCall) {
        ImsPhoneCall imsPhoneCall = (ImsPhoneCall) call;
        ImsCall imsCall = imsPhoneCall.getImsCall();
        return imsCall != null && (imsCall.isVideoCall() || imsCall.wasVideoCall());
    }
    return isDowngradedVideoCall;
}
Also used : ImsCall(com.android.ims.ImsCall) ImsPhoneCall(com.android.internal.telephony.imsphone.ImsPhoneCall)

Example 15 with ImsCall

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

the class ImsPhoneCallTrackerTest method testVtDataUsageProvider.

@Test
@SmallTest
public void testVtDataUsageProvider() throws RemoteException {
    mVtDataUsageProvider.onRequestStatsUpdate(11);
    // Verify that requestStatsUpdate triggers onStatsUpdated, where the initial token should
    // be reported with current stats.
    assertVtDataUsageUpdated(0, 0, 0);
    // Establish a MT call.
    testImsMTCallAccept();
    final ImsPhoneConnection connection = mCTUT.mForegroundCall.getFirstConnection();
    final ImsCall call = connection.getImsCall();
    mCTUT.updateVtDataUsage(call, 51);
    // Make another request, and verify stats updated accordingly, with previously issued token.
    reset(mVtDataUsageProviderCb);
    mVtDataUsageProvider.onRequestStatsUpdate(13);
    assertVtDataUsageUpdated(11, 25, 25);
    // Update accumulated data usage twice. updateVtDataUsage takes accumulated stats from
    // boot up.
    reset(mVtDataUsageProviderCb);
    mCTUT.updateVtDataUsage(call, 70);
    mCTUT.updateVtDataUsage(call, 91);
    verify(mVtDataUsageProviderCb, never()).notifyStatsUpdated(anyInt(), any(), any());
    // Verify that diff stats from last update is reported accordingly.
    mVtDataUsageProvider.onRequestStatsUpdate(13);
    // Rounding error occurs so (70-51)/2 + (91-70)/2 = 19 is expected for both direction.
    assertVtDataUsageUpdated(13, 19, 19);
}
Also used : ImsCall(com.android.ims.ImsCall) FlakyTest(androidx.test.filters.FlakyTest) TelephonyTest(com.android.internal.telephony.TelephonyTest) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

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