Search in sources :

Example 31 with ImsCall

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

the class ImsCallTest method testNonNulllVideoProfile.

@Test
@SmallTest
public void testNonNulllVideoProfile() {
    ImsCallProfile profile = new ImsCallProfile();
    profile.mCallType = ImsCallProfile.CALL_TYPE_VT_TX;
    ImsCall imsCall = new ImsCall(mContext, profile);
    assertNotNull(imsCall);
    assertTrue(imsCall.wasVideoCall());
}
Also used : ImsCallProfile(android.telephony.ims.ImsCallProfile) 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)

Example 32 with ImsCall

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

the class ImsPhoneCallTrackerTest method testNotifyHandovers.

/**
 * Test notification of handover from LTE to WIFI and WIFI to LTE and ensure that the expected
 * connection events are sent.
 */
@Test
@SmallTest
public void testNotifyHandovers() {
    setupCarrierConfig();
    // establish a MT call
    testImsMTCallAccept();
    ImsPhoneConnection connection = (ImsPhoneConnection) mCTUT.mForegroundCall.getConnections().get(0);
    ImsCall call = connection.getImsCall();
    // Needs to be a video call to see this signalling.
    mImsCallProfile.mCallType = ImsCallProfile.CALL_TYPE_VT;
    // First handover from LTE to WIFI; this takes us into a mid-call state.
    call.getImsCallSessionListenerProxy().callSessionHandover(call.getCallSession(), TelephonyManager.NETWORK_TYPE_LTE, TelephonyManager.NETWORK_TYPE_IWLAN, new ImsReasonInfo());
    // Handover back to LTE.
    call.getImsCallSessionListenerProxy().callSessionHandover(call.getCallSession(), TelephonyManager.NETWORK_TYPE_IWLAN, TelephonyManager.NETWORK_TYPE_LTE, new ImsReasonInfo());
    verify(mImsPhoneConnectionListener).onConnectionEvent(eq(TelephonyManager.EVENT_HANDOVER_VIDEO_FROM_WIFI_TO_LTE), isNull());
    // Finally hand back to WIFI
    call.getImsCallSessionListenerProxy().callSessionHandover(call.getCallSession(), TelephonyManager.NETWORK_TYPE_LTE, TelephonyManager.NETWORK_TYPE_IWLAN, new ImsReasonInfo());
    verify(mImsPhoneConnectionListener).onConnectionEvent(eq(TelephonyManager.EVENT_HANDOVER_VIDEO_FROM_LTE_TO_WIFI), isNull());
}
Also used : ImsCall(com.android.ims.ImsCall) ImsReasonInfo(android.telephony.ims.ImsReasonInfo) 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)

Example 33 with ImsCall

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

the class ImsPhoneCallTrackerTest method testRewriteOutgoingNumber.

@Test
@SmallTest
public void testRewriteOutgoingNumber() {
    try {
        doAnswer(new Answer<ImsCall>() {

            @Override
            public ImsCall answer(InvocationOnMock invocation) throws Throwable {
                mImsCallListener = (ImsCall.Listener) invocation.getArguments()[2];
                ImsCall imsCall = spy(new ImsCall(mContext, mImsCallProfile));
                imsCall.setListener(mImsCallListener);
                imsCallMocking(imsCall);
                return imsCall;
            }
        }).when(mImsManager).makeCall(eq(mImsCallProfile), (String[]) any(), (ImsCall.Listener) any());
    } catch (ImsException ie) {
    }
    // Perform a dial string remapping.
    PersistableBundle bundle = mContextFixture.getCarrierConfigBundle();
    bundle.putStringArray(CarrierConfigManager.KEY_DIAL_STRING_REPLACE_STRING_ARRAY, new String[] { "*55:6505551212" });
    ImsPhoneConnection connection = null;
    try {
        connection = (ImsPhoneConnection) mCTUT.dial("*55", ImsCallProfile.CALL_TYPE_VOICE, null);
    } catch (Exception ex) {
        ex.printStackTrace();
        Assert.fail("unexpected exception thrown" + ex.getMessage());
    }
    if (connection == null) {
        Assert.fail("connection is null");
    }
    Assert.assertEquals("6505551212", connection.getConvertedNumber());
    Assert.assertEquals("*55", connection.getAddress());
}
Also used : PersistableBundle(android.os.PersistableBundle) ImsCall(com.android.ims.ImsCall) InvocationOnMock(org.mockito.invocation.InvocationOnMock) ImsException(com.android.ims.ImsException) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ImsException(com.android.ims.ImsException) RemoteException(android.os.RemoteException) CallStateException(com.android.internal.telephony.CallStateException) 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)

Example 34 with ImsCall

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

the class ImsPhoneCallTrackerTest method testRemoteHoldtone.

@Test
@SmallTest
public void testRemoteHoldtone() {
    // Set carrier config to always play remote hold tone.
    mCTUT.setAlwaysPlayRemoteHoldTone(true);
    // establish a MT call
    testImsMTCallAccept();
    ImsPhoneConnection connection = mCTUT.mForegroundCall.getFirstConnection();
    ImsCall call = connection.getImsCall();
    // Set the media direction to send/receive; normally we don't play a hold tone but the
    // carrier config option is set to ensure we will do it in this case.
    ImsCallProfile callProfile = new ImsCallProfile();
    callProfile.mMediaProfile.mAudioDirection = ImsStreamMediaProfile.DIRECTION_SEND_RECEIVE;
    call.setCallProfile(callProfile);
    try {
        mCTUT.onCallHoldReceived(call);
    } catch (Exception ex) {
        ex.printStackTrace();
        Assert.fail("unexpected exception thrown" + ex.getMessage());
    }
    verify(mImsPhone, times(1)).startOnHoldTone(nullable(Connection.class));
}
Also used : ImsCallProfile(android.telephony.ims.ImsCallProfile) ImsCall(com.android.ims.ImsCall) Connection(com.android.internal.telephony.Connection) ImsException(com.android.ims.ImsException) RemoteException(android.os.RemoteException) CallStateException(com.android.internal.telephony.CallStateException) 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)

Example 35 with ImsCall

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

the class ImsPhoneCallTracker method scheduleHandoverCheck.

/**
 * If the foreground call is a video call, schedule a handover check if one is not already
 * scheduled.  This method is intended ONLY for use when scheduling to watch for mid-call
 * handovers.
 */
private void scheduleHandoverCheck() {
    ImsCall fgCall = mForegroundCall.getImsCall();
    ImsPhoneConnection conn = mForegroundCall.getFirstConnection();
    if (!mNotifyVtHandoverToWifiFail || fgCall == null || !fgCall.isVideoCall() || conn == null || conn.getDisconnectCause() != DisconnectCause.NOT_DISCONNECTED) {
        return;
    }
    if (!hasMessages(EVENT_CHECK_FOR_WIFI_HANDOVER)) {
        Rlog.i(LOG_TAG, "scheduleHandoverCheck: schedule");
        sendMessageDelayed(obtainMessage(EVENT_CHECK_FOR_WIFI_HANDOVER, fgCall), HANDOVER_TO_WIFI_TIMEOUT_MS);
    }
}
Also used : ImsCall(com.android.ims.ImsCall)

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