Search in sources :

Example 16 with ImsCall

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

the class ImsPhoneCallTrackerTest method testRemoteToneInactive.

/**
 * Verifies that a remote hold tone is played when the call is remotely held and the media
 * direction is inactive (i.e. the audio stream is not playing, so we should play the tone).
 */
@Test
@SmallTest
public void testRemoteToneInactive() {
    // establish a MT call
    testImsMTCallAccept();
    ImsPhoneConnection connection = mCTUT.mForegroundCall.getFirstConnection();
    ImsCall call = connection.getImsCall();
    // Set the media direction to inactive to trigger a hold tone.
    ImsCallProfile callProfile = new ImsCallProfile();
    callProfile.mMediaProfile.mAudioDirection = ImsStreamMediaProfile.DIRECTION_INACTIVE;
    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 17 with ImsCall

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

the class ImsPhoneCallTrackerTest method testMergeComplete.

@Test
@SmallTest
public void testMergeComplete() {
    boolean[] result = new boolean[1];
    // Place a call.
    ImsPhoneConnection connection = placeCallAndMakeActive();
    connection.addListener(new Connection.ListenerBase() {

        @Override
        public void onConnectionEvent(String event, Bundle extras) {
            result[0] = android.telecom.Connection.EVENT_MERGE_COMPLETE.equals(event);
        }
    });
    ImsCall call = connection.getImsCall();
    call.getListener().onCallMerged(call, null, false);
    assertTrue(result[0]);
}
Also used : Bundle(android.os.Bundle) PersistableBundle(android.os.PersistableBundle) ImsCall(com.android.ims.ImsCall) Connection(com.android.internal.telephony.Connection) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) 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 18 with ImsCall

use of com.android.ims.ImsCall 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 19 with ImsCall

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

the class ImsCallTest method testNullCallProfile.

@Test
@SmallTest
public void testNullCallProfile() {
    ImsCall imsCall = new ImsCall(mContext, null);
    assertNotNull(imsCall);
    assertFalse(imsCall.wasVideoCall());
}
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)

Example 20 with ImsCall

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

the class ImsCallTest method testSetLteNoWifiDeprecated.

@Test
@SmallTest
public void testSetLteNoWifiDeprecated() {
    ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile);
    assertFalse(mTestImsCall.isWifiCall());
    assertNotEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
    mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE, ServiceState.RIL_RADIO_TECHNOLOGY_LTE + "");
    assertFalse(mTestImsCall.isWifiCall());
    assertEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
}
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)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