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());
}
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());
}
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());
}
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));
}
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);
}
}
Aggregations