use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneCallTracker method holdActiveCallForWaitingCall.
/**
* Hold the currently active call in order to answer the waiting call.
*/
public void holdActiveCallForWaitingCall() throws CallStateException {
boolean switchingWithWaitingCall = !mBackgroundCall.getState().isAlive() && mRingingCall.getState() == ImsPhoneCall.State.WAITING;
if (switchingWithWaitingCall) {
ImsCall callToHold = mForegroundCall.getImsCall();
HoldSwapState oldHoldState = mHoldSwitchingState;
mHoldSwitchingState = HoldSwapState.HOLDING_TO_ANSWER_INCOMING;
mForegroundCall.switchWith(mBackgroundCall);
logHoldSwapState("holdActiveCallForWaitingCall");
try {
callToHold.hold();
mMetrics.writeOnImsCommand(mPhone.getPhoneId(), callToHold.getSession(), ImsCommand.IMS_CMD_HOLD);
} catch (ImsException e) {
mForegroundCall.switchWith(mBackgroundCall);
mHoldSwitchingState = oldHoldState;
logHoldSwapState("holdActiveCallForWaitingCall - fail");
throw new CallStateException(e.getMessage());
}
}
}
use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneConnection method updateImsCallRatFromExtras.
/**
* Updates the IMS call rat based on the {@link ImsCallProfile#EXTRA_CALL_RAT_TYPE}.
*
* @param extras The ImsCallProfile extras.
*/
private void updateImsCallRatFromExtras(Bundle extras) {
if (extras.containsKey(ImsCallProfile.EXTRA_CALL_NETWORK_TYPE) || extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE) || extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE_ALT)) {
ImsCall call = getImsCall();
int networkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
if (call != null) {
networkType = call.getNetworkType();
}
// Report any changes for network type change
setCallRadioTech(ServiceState.networkTypeToRilRadioTechnology(networkType));
}
}
use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneConnection method startRtt.
/**
* Send a RTT upgrade request to the remote party.
* @param textStream RTT text stream to use
*/
public void startRtt(android.telecom.Connection.RttTextStream textStream) {
ImsCall imsCall = getImsCall();
if (imsCall != null) {
getImsCall().sendRttModifyRequest(true);
setCurrentRttTextStream(textStream);
}
}
use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneCallTracker method answerWaitingCall.
private void answerWaitingCall() throws ImsException {
// accept waiting call after holding background call
ImsCall imsCall = mRingingCall.getImsCall();
if (imsCall != null) {
mPhone.getVoiceCallSessionStats().onImsAcceptCall(mRingingCall.getConnections());
imsCall.accept(ImsCallProfile.getCallTypeFromVideoState(mPendingCallVideoState));
mMetrics.writeOnImsCommand(mPhone.getPhoneId(), imsCall.getSession(), ImsCommand.IMS_CMD_ACCEPT);
}
}
use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneCallTracker method holdActiveCall.
/**
* Holds the active call, possibly resuming the already-held background call if it exists.
*/
public void holdActiveCall() throws CallStateException {
if (mForegroundCall.getState() == ImsPhoneCall.State.ACTIVE) {
if (mHoldSwitchingState == HoldSwapState.PENDING_SINGLE_CALL_HOLD || mHoldSwitchingState == HoldSwapState.SWAPPING_ACTIVE_AND_HELD) {
logi("Ignoring hold request while already holding or swapping");
return;
}
HoldSwapState oldHoldState = mHoldSwitchingState;
ImsCall callToHold = mForegroundCall.getImsCall();
if (mBackgroundCall.getState().isAlive()) {
mCallExpectedToResume = mBackgroundCall.getImsCall();
mHoldSwitchingState = HoldSwapState.SWAPPING_ACTIVE_AND_HELD;
} else {
mHoldSwitchingState = HoldSwapState.PENDING_SINGLE_CALL_HOLD;
}
logHoldSwapState("holdActiveCall");
mForegroundCall.switchWith(mBackgroundCall);
try {
callToHold.hold();
mMetrics.writeOnImsCommand(mPhone.getPhoneId(), callToHold.getSession(), ImsCommand.IMS_CMD_HOLD);
} catch (ImsException e) {
mForegroundCall.switchWith(mBackgroundCall);
mHoldSwitchingState = oldHoldState;
logHoldSwapState("holdActiveCall - fail");
throw new CallStateException(e.getMessage());
}
}
}
Aggregations