Search in sources :

Example 6 with ImsCallProfile

use of android.telephony.ims.ImsCallProfile in project android_frameworks_opt_telephony by LineageOS.

the class ImsPhoneCallTrackerTest method testNoRemoteHoldtone.

/**
 * Tests that no hold tone is played if the call is remotely held and the media direction is
 * send/receive (i.e. there is an audio stream present).
 */
@Test
@SmallTest
public void testNoRemoteHoldtone() {
    // establish a MT call
    testImsMTCallAccept();
    ImsPhoneConnection connection = mCTUT.mForegroundCall.getFirstConnection();
    ImsCall call = connection.getImsCall();
    // Set the media direction to send/receive.
    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, never()).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 7 with ImsCallProfile

use of android.telephony.ims.ImsCallProfile in project android_frameworks_opt_telephony by LineageOS.

the class ImsCallTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp(getClass().getSimpleName());
    mTestCallProfile = new ImsCallProfile();
    mBundle = mTestCallProfile.mCallExtras;
}
Also used : ImsCallProfile(android.telephony.ims.ImsCallProfile) Before(org.junit.Before)

Example 8 with ImsCallProfile

use of android.telephony.ims.ImsCallProfile in project android_frameworks_opt_telephony by LineageOS.

the class ImsPhoneCallTrackerTest method placeCallAndMakeActive.

private ImsPhoneConnection placeCallAndMakeActive() {
    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) {
    }
    ImsPhoneConnection connection = null;
    try {
        connection = (ImsPhoneConnection) mCTUT.dial("+16505551212", 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");
    }
    ImsCall imsCall = connection.getImsCall();
    imsCall.getImsCallSessionListenerProxy().callSessionProgressing(imsCall.getSession(), new ImsStreamMediaProfile());
    imsCall.getImsCallSessionListenerProxy().callSessionStarted(imsCall.getSession(), new ImsCallProfile());
    return connection;
}
Also used : ImsCallProfile(android.telephony.ims.ImsCallProfile) ImsCall(com.android.ims.ImsCall) InvocationOnMock(org.mockito.invocation.InvocationOnMock) ImsStreamMediaProfile(android.telephony.ims.ImsStreamMediaProfile) 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)

Example 9 with ImsCallProfile

use of android.telephony.ims.ImsCallProfile 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 10 with ImsCallProfile

use of android.telephony.ims.ImsCallProfile 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)

Aggregations

ImsCallProfile (android.telephony.ims.ImsCallProfile)16 ImsCall (com.android.ims.ImsCall)8 ImsException (com.android.ims.ImsException)8 RemoteException (android.os.RemoteException)5 SmallTest (android.test.suitebuilder.annotation.SmallTest)5 CallStateException (com.android.internal.telephony.CallStateException)5 Test (org.junit.Test)5 Connection (com.android.internal.telephony.Connection)4 TelephonyTest (com.android.internal.telephony.TelephonyTest)4 Bundle (android.os.Bundle)3 FlakyTest (androidx.test.filters.FlakyTest)3 ImsPhone (com.android.internal.telephony.imsphone.ImsPhone)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 ContentResolver (android.content.ContentResolver)1 Context (android.content.Context)1 NetworkCapabilities (android.net.NetworkCapabilities)1 AsyncResult (android.os.AsyncResult)1 Handler (android.os.Handler)1 IBinder (android.os.IBinder)1