Search in sources :

Example 1 with ImsStreamMediaProfile

use of android.telephony.ims.ImsStreamMediaProfile 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 2 with ImsStreamMediaProfile

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

the class ImsPhoneCallTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp(getClass().getSimpleName());
    replaceInstance(ImsPhoneCallTracker.class, "mPhone", mImsCT, mImsPhone);
    mImsCallUT = new ImsPhoneCall(mImsCT, ImsPhoneCall.CONTEXT_FOREGROUND);
    when(mImsCT.getPhone()).thenReturn(mImsPhone);
    mMediaProfile = new ImsStreamMediaProfile();
}
Also used : ImsStreamMediaProfile(android.telephony.ims.ImsStreamMediaProfile) Before(org.junit.Before)

Aggregations

ImsStreamMediaProfile (android.telephony.ims.ImsStreamMediaProfile)2 RemoteException (android.os.RemoteException)1 ImsCallProfile (android.telephony.ims.ImsCallProfile)1 ImsCall (com.android.ims.ImsCall)1 ImsException (com.android.ims.ImsException)1 CallStateException (com.android.internal.telephony.CallStateException)1 Before (org.junit.Before)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1