use of com.android.ims.ImsException 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();
}
String backgroundId = "";
ImsPhoneConnection backgroundConnection = findConnection(bgImsCall);
if (backgroundConnection != null) {
backgroundConnection.handleMergeStart();
backgroundId = backgroundConnection.getTelecomCallId();
}
log("conference: fgCallId=" + foregroundId + ", bgCallId=" + backgroundId);
try {
fgImsCall.merge(bgImsCall);
} catch (ImsException e) {
log("conference " + e.getMessage());
}
}
use of com.android.ims.ImsException in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneCallTracker method dialInternal.
private void dialInternal(ImsPhoneConnection conn, int clirMode, int videoState, Bundle intentExtras) {
if (conn == null) {
return;
}
if (conn.getAddress() == null || conn.getAddress().length() == 0 || conn.getAddress().indexOf(PhoneNumberUtils.WILD) >= 0) {
// Phone number is invalid
conn.setDisconnectCause(DisconnectCause.INVALID_NUMBER);
sendEmptyMessageDelayed(EVENT_HANGUP_PENDINGMO, TIMEOUT_HANGUP_PENDINGMO);
return;
}
// Always unmute when initiating a new call
setMute(false);
int serviceType = mPhoneNumberUtilsProxy.isEmergencyNumber(conn.getAddress()) ? ImsCallProfile.SERVICE_TYPE_EMERGENCY : ImsCallProfile.SERVICE_TYPE_NORMAL;
int callType = ImsCallProfile.getCallTypeFromVideoState(videoState);
// TODO(vt): Is this sufficient? At what point do we know the video state of the call?
conn.setVideoState(videoState);
try {
String[] callees = new String[] { conn.getAddress() };
ImsCallProfile profile = mImsManager.createCallProfile(mServiceId, serviceType, callType);
profile.setCallExtraInt(ImsCallProfile.EXTRA_OIR, clirMode);
// ImsCallProfile key.
if (intentExtras != null) {
if (intentExtras.containsKey(android.telecom.TelecomManager.EXTRA_CALL_SUBJECT)) {
intentExtras.putString(ImsCallProfile.EXTRA_DISPLAY_TEXT, cleanseInstantLetteringMessage(intentExtras.getString(android.telecom.TelecomManager.EXTRA_CALL_SUBJECT)));
}
if (intentExtras.containsKey(ImsCallProfile.EXTRA_IS_CALL_PULL)) {
profile.mCallExtras.putBoolean(ImsCallProfile.EXTRA_IS_CALL_PULL, intentExtras.getBoolean(ImsCallProfile.EXTRA_IS_CALL_PULL));
int dialogId = intentExtras.getInt(ImsExternalCallTracker.EXTRA_IMS_EXTERNAL_CALL_ID);
conn.setIsPulledCall(true);
conn.setPulledDialogId(dialogId);
}
// Pack the OEM-specific call extras.
profile.mCallExtras.putBundle(ImsCallProfile.EXTRA_OEM_EXTRAS, intentExtras);
// NOTE: Extras to be sent over the network are packed into the
// intentExtras individually, with uniquely defined keys.
// These key-value pairs are processed by IMS Service before
// being sent to the lower layers/to the network.
}
ImsCall imsCall = mImsManager.makeCall(mServiceId, profile, callees, mImsCallListener);
conn.setImsCall(imsCall);
mMetrics.writeOnImsCallStart(mPhone.getPhoneId(), imsCall.getSession());
setVideoCallProvider(conn, imsCall);
conn.setAllowAddCallDuringVideoCall(mAllowAddCallDuringVideoCall);
} catch (ImsException e) {
loge("dialInternal : " + e);
conn.setDisconnectCause(DisconnectCause.ERROR_UNSPECIFIED);
sendEmptyMessageDelayed(EVENT_HANGUP_PENDINGMO, TIMEOUT_HANGUP_PENDINGMO);
retryGetImsService();
} catch (RemoteException e) {
}
}
use of com.android.ims.ImsException in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhone method getCallForwardingOption.
@Override
public void getCallForwardingOption(int commandInterfaceCFReason, Message onComplete) {
if (DBG)
Rlog.d(LOG_TAG, "getCallForwardingOption reason=" + commandInterfaceCFReason);
if (isValidCommandInterfaceCFReason(commandInterfaceCFReason)) {
if (DBG)
Rlog.d(LOG_TAG, "requesting call forwarding query.");
Message resp;
resp = obtainMessage(EVENT_GET_CALL_FORWARD_DONE, onComplete);
try {
ImsUtInterface ut = mCT.getUtInterface();
ut.queryCallForward(getConditionFromCFReason(commandInterfaceCFReason), null, resp);
} catch (ImsException e) {
sendErrorResponse(onComplete, e);
}
} else if (onComplete != null) {
sendErrorResponse(onComplete);
}
}
use of com.android.ims.ImsException in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhone method getCallWaiting.
@Override
public void getCallWaiting(Message onComplete) {
if (DBG)
Rlog.d(LOG_TAG, "getCallWaiting");
Message resp;
resp = obtainMessage(EVENT_GET_CALL_WAITING_DONE, onComplete);
try {
ImsUtInterface ut = mCT.getUtInterface();
ut.queryCallWaiting(resp);
} catch (ImsException e) {
sendErrorResponse(onComplete, e);
}
}
use of com.android.ims.ImsException in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneCallTracker method sendUSSD.
public void sendUSSD(String ussdString, Message response) {
if (DBG)
log("sendUSSD");
try {
if (mUssdSession != null) {
mUssdSession.sendUssd(ussdString);
AsyncResult.forMessage(response, null, null);
response.sendToTarget();
return;
}
if (mImsManager == null) {
mPhone.sendErrorResponse(response, getImsManagerIsNullException());
return;
}
String[] callees = new String[] { ussdString };
ImsCallProfile profile = mImsManager.createCallProfile(mServiceId, ImsCallProfile.SERVICE_TYPE_NORMAL, ImsCallProfile.CALL_TYPE_VOICE);
profile.setCallExtraInt(ImsCallProfile.EXTRA_DIALSTRING, ImsCallProfile.DIALSTRING_USSD);
mUssdSession = mImsManager.makeCall(mServiceId, profile, callees, mImsUssdListener);
} catch (ImsException e) {
loge("sendUSSD : " + e);
mPhone.sendErrorResponse(response, e);
retryGetImsService();
}
}
Aggregations