use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneCallTracker method conference.
public void conference() {
ImsCall fgImsCall = mForegroundCall.getImsCall();
if (fgImsCall == null) {
log("conference no foreground ims call");
return;
}
ImsCall bgImsCall = mBackgroundCall.getImsCall();
if (bgImsCall == null) {
log("conference no background ims call");
return;
}
if (fgImsCall.isCallSessionMergePending()) {
log("conference: skip; foreground call already in process of merging.");
return;
}
if (bgImsCall.isCallSessionMergePending()) {
log("conference: skip; background call already in process of merging.");
return;
}
// Keep track of the connect time of the earliest call so that it can be set on the
// {@code ImsConference} when it is created.
long foregroundConnectTime = mForegroundCall.getEarliestConnectTime();
long backgroundConnectTime = mBackgroundCall.getEarliestConnectTime();
long conferenceConnectTime;
if (foregroundConnectTime > 0 && backgroundConnectTime > 0) {
conferenceConnectTime = Math.min(mForegroundCall.getEarliestConnectTime(), mBackgroundCall.getEarliestConnectTime());
log("conference - using connect time = " + conferenceConnectTime);
} else if (foregroundConnectTime > 0) {
log("conference - bg call connect time is 0; using fg = " + foregroundConnectTime);
conferenceConnectTime = foregroundConnectTime;
} else {
log("conference - fg call connect time is 0; using bg = " + backgroundConnectTime);
conferenceConnectTime = backgroundConnectTime;
}
String foregroundId = "";
ImsPhoneConnection foregroundConnection = mForegroundCall.getFirstConnection();
if (foregroundConnection != null) {
foregroundConnection.setConferenceConnectTime(conferenceConnectTime);
foregroundConnection.handleMergeStart();
foregroundId = foregroundConnection.getTelecomCallId();
cacheConnectionTimeWithPhoneNumber(foregroundConnection);
}
String backgroundId = "";
ImsPhoneConnection backgroundConnection = findConnection(bgImsCall);
if (backgroundConnection != null) {
backgroundConnection.handleMergeStart();
backgroundId = backgroundConnection.getTelecomCallId();
cacheConnectionTimeWithPhoneNumber(backgroundConnection);
}
log("conference: fgCallId=" + foregroundId + ", bgCallId=" + backgroundId);
mOperationLocalLog.log("conference: fgCallId=" + foregroundId + ", bgCallId=" + backgroundId);
try {
fgImsCall.merge(bgImsCall);
} catch (ImsException e) {
log("conference " + e.getMessage());
handleConferenceFailed(foregroundConnection, backgroundConnection);
}
}
use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneConnection method sendRttModifyResponse.
/**
* Sends the user's response to a remotely-issued RTT upgrade request
*
* @param textStream A valid {@link android.telecom.Connection.RttTextStream} if the user
* accepts, {@code null} if not.
*/
public void sendRttModifyResponse(android.telecom.Connection.RttTextStream textStream) {
boolean accept = textStream != null;
ImsCall imsCall = getImsCall();
if (imsCall != null) {
imsCall.sendRttModifyResponse(accept);
if (accept) {
setCurrentRttTextStream(textStream);
} else {
Rlog.e(LOG_TAG, "sendRttModifyResponse: foreground call has no connections");
}
}
}
use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneCall method setMute.
/**
* Sets the mute state of the call.
* @param mute {@code true} if the call could be muted; {@code false} otherwise.
*/
@VisibleForTesting
public void setMute(boolean mute) {
ImsPhoneConnection connection = getFirstConnection();
ImsCall imsCall = connection == null ? null : connection.getImsCall();
if (imsCall != null) {
try {
imsCall.setMute(mute);
} catch (ImsException e) {
Rlog.e(LOG_TAG, "setMute failed : " + e.getMessage());
}
}
}
use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class Phone method isVideoCallOrConference.
/**
* Determines if the specified call currently is or was at some point a video call, or if it is
* a conference call.
* @param call The call.
* @return {@code true} if the call is or was a video call or is a conference call,
* {@code false} otherwise.
*/
private boolean isVideoCallOrConference(Call call) {
if (call.isMultiparty()) {
return true;
}
boolean isDowngradedVideoCall = false;
if (call instanceof ImsPhoneCall) {
ImsPhoneCall imsPhoneCall = (ImsPhoneCall) call;
ImsCall imsCall = imsPhoneCall.getImsCall();
return imsCall != null && (imsCall.isVideoCall() || imsCall.wasVideoCall());
}
return isDowngradedVideoCall;
}
use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneCallTrackerTest method testVtDataUsageProvider.
@Test
@SmallTest
public void testVtDataUsageProvider() throws RemoteException {
mVtDataUsageProvider.onRequestStatsUpdate(11);
// Verify that requestStatsUpdate triggers onStatsUpdated, where the initial token should
// be reported with current stats.
assertVtDataUsageUpdated(0, 0, 0);
// Establish a MT call.
testImsMTCallAccept();
final ImsPhoneConnection connection = mCTUT.mForegroundCall.getFirstConnection();
final ImsCall call = connection.getImsCall();
mCTUT.updateVtDataUsage(call, 51);
// Make another request, and verify stats updated accordingly, with previously issued token.
reset(mVtDataUsageProviderCb);
mVtDataUsageProvider.onRequestStatsUpdate(13);
assertVtDataUsageUpdated(11, 25, 25);
// Update accumulated data usage twice. updateVtDataUsage takes accumulated stats from
// boot up.
reset(mVtDataUsageProviderCb);
mCTUT.updateVtDataUsage(call, 70);
mCTUT.updateVtDataUsage(call, 91);
verify(mVtDataUsageProviderCb, never()).notifyStatsUpdated(anyInt(), any(), any());
// Verify that diff stats from last update is reported accordingly.
mVtDataUsageProvider.onRequestStatsUpdate(13);
// Rounding error occurs so (70-51)/2 + (91-70)/2 = 19 is expected for both direction.
assertVtDataUsageUpdated(13, 19, 19);
}
Aggregations