Methods Summary |
---|
void | acceptCall(int videoState)Accepts a call with the specified video state. The video state is the video state that the
user has agreed upon in the InCall UI.
if (DBG) log("acceptCall");
if (mForegroundCall.getState().isAlive()
&& mBackgroundCall.getState().isAlive()) {
throw new CallStateException("cannot accept call");
}
if ((mRingingCall.getState() == ImsPhoneCall.State.WAITING)
&& mForegroundCall.getState().isAlive()) {
setMute(false);
switchWaitingOrHoldingAndActive();
} else if (mRingingCall.getState().isRinging()) {
if (DBG) log("acceptCall: incoming...");
// Always unmute when answering a new call
setMute(false);
try {
ImsCall imsCall = mRingingCall.getImsCall();
if (imsCall != null) {
imsCall.accept(ImsCallProfile.getCallTypeFromVideoState(videoState));
} else {
throw new CallStateException("no valid ims call");
}
} catch (ImsException e) {
throw new CallStateException("cannot accept call");
}
} else {
throw new CallStateException("phone not ringing");
}
|
private synchronized void | addConnection(ImsPhoneConnection conn)
mConnections.add(conn);
|
void | callEndCleanupHandOverCallIfAny()
if (mHandoverCall.mConnections.size() > 0) {
if (DBG) log("callEndCleanupHandOverCallIfAny, mHandoverCall.mConnections="
+ mHandoverCall.mConnections);
mHandoverCall.mConnections.clear();
mState = PhoneConstants.State.IDLE;
}
|
boolean | canConference()
return mForegroundCall.getState() == ImsPhoneCall.State.ACTIVE
&& mBackgroundCall.getState() == ImsPhoneCall.State.HOLDING
&& !mBackgroundCall.isFull()
&& !mForegroundCall.isFull();
|
boolean | canDial()
boolean ret;
int serviceState = mPhone.getServiceState().getState();
String disableCall = SystemProperties.get(
TelephonyProperties.PROPERTY_DISABLE_CALL, "false");
ret = (serviceState != ServiceState.STATE_POWER_OFF)
&& mPendingMO == null
&& !mRingingCall.isRinging()
&& !disableCall.equals("true")
&& (!mForegroundCall.getState().isAlive()
|| !mBackgroundCall.getState().isAlive());
return ret;
|
boolean | canTransfer()
return mForegroundCall.getState() == ImsPhoneCall.State.ACTIVE
&& mBackgroundCall.getState() == ImsPhoneCall.State.HOLDING;
|
void | cancelUSSD()
if (mUssdSession == null) return;
try {
mUssdSession.terminate(ImsReasonInfo.CODE_USER_TERMINATED);
} catch (ImsException e) {
}
|
void | clearDisconnected()
if (DBG) log("clearDisconnected");
internalClearDisconnected();
updatePhoneState();
mPhone.notifyPreciseCallStateChanged();
|
void | conference()
if (DBG) log("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;
}
// 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 conferenceConnectTime = Math.min(mForegroundCall.getEarliestConnectTime(),
mBackgroundCall.getEarliestConnectTime());
ImsPhoneConnection foregroundConnection = mForegroundCall.getFirstConnection();
if (foregroundConnection != null) {
foregroundConnection.setConferenceConnectTime(conferenceConnectTime);
}
try {
fgImsCall.merge(bgImsCall);
} catch (ImsException e) {
log("conference " + e.getMessage());
}
|
private android.app.PendingIntent | createIncomingCallPendingIntent()
Intent intent = new Intent(ImsManager.ACTION_IMS_INCOMING_CALL);
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
return PendingIntent.getBroadcast(mPhone.getContext(), 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
|
com.android.internal.telephony.Connection | dial(java.lang.String dialString, int videoState)
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mPhone.getContext());
int oirMode = sp.getInt(PhoneBase.CLIR_KEY, CommandsInterface.CLIR_DEFAULT);
return dial(dialString, oirMode, videoState);
|
synchronized com.android.internal.telephony.Connection | dial(java.lang.String dialString, int clirMode, int videoState)oirMode is one of the CLIR_ constants
boolean isPhoneInEcmMode = SystemProperties.getBoolean(
TelephonyProperties.PROPERTY_INECM_MODE, false);
boolean isEmergencyNumber = PhoneNumberUtils.isEmergencyNumber(dialString);
if (DBG) log("dial clirMode=" + clirMode);
// note that this triggers call state changed notif
clearDisconnected();
if (mImsManager == null) {
throw new CallStateException("service not available");
}
if (!canDial()) {
throw new CallStateException("cannot dial in current state");
}
if (isPhoneInEcmMode && isEmergencyNumber) {
handleEcmTimer(ImsPhone.CANCEL_ECM_TIMER);
}
boolean holdBeforeDial = false;
// The new call must be assigned to the foreground call.
// That call must be idle, so place anything that's
// there on hold
if (mForegroundCall.getState() == ImsPhoneCall.State.ACTIVE) {
if (mBackgroundCall.getState() != ImsPhoneCall.State.IDLE) {
//we should have failed in !canDial() above before we get here
throw new CallStateException("cannot dial in current state");
}
// foreground call is empty for the newly dialed connection
holdBeforeDial = true;
switchWaitingOrHoldingAndActive();
}
ImsPhoneCall.State fgState = ImsPhoneCall.State.IDLE;
ImsPhoneCall.State bgState = ImsPhoneCall.State.IDLE;
mClirMode = clirMode;
synchronized (mSyncHold) {
if (holdBeforeDial) {
fgState = mForegroundCall.getState();
bgState = mBackgroundCall.getState();
//holding foreground call failed
if (fgState == ImsPhoneCall.State.ACTIVE) {
throw new CallStateException("cannot dial in current state");
}
//holding foreground call succeeded
if (bgState == ImsPhoneCall.State.HOLDING) {
holdBeforeDial = false;
}
}
mPendingMO = new ImsPhoneConnection(mPhone.getContext(),
checkForTestEmergencyNumber(dialString), this, mForegroundCall);
}
addConnection(mPendingMO);
if (!holdBeforeDial) {
if ((!isPhoneInEcmMode) || (isPhoneInEcmMode && isEmergencyNumber)) {
dialInternal(mPendingMO, clirMode, videoState);
} else {
try {
getEcbmInterface().exitEmergencyCallbackMode();
} catch (ImsException e) {
e.printStackTrace();
throw new CallStateException("service not available");
}
mPhone.setOnEcbModeExitResponse(this, EVENT_EXIT_ECM_RESPONSE_CDMA, null);
pendingCallClirMode = clirMode;
pendingCallVideoState = videoState;
pendingCallInEcm = true;
}
}
updatePhoneState();
mPhone.notifyPreciseCallStateChanged();
return mPendingMO;
|
private void | dialInternal(ImsPhoneConnection conn, int clirMode, int videoState)
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 = PhoneNumberUtils.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);
ImsCall imsCall = mImsManager.makeCall(mServiceId, profile,
callees, mImsCallListener);
conn.setImsCall(imsCall);
IImsVideoCallProvider imsVideoCallProvider =
imsCall.getCallSession().getVideoCallProvider();
if (imsVideoCallProvider != null) {
ImsVideoCallProviderWrapper imsVideoCallProviderWrapper =
new ImsVideoCallProviderWrapper(imsVideoCallProvider);
conn.setVideoProvider(imsVideoCallProviderWrapper);
}
} catch (ImsException e) {
loge("dialInternal : " + e);
conn.setDisconnectCause(DisconnectCause.ERROR_UNSPECIFIED);
sendEmptyMessageDelayed(EVENT_HANGUP_PENDINGMO, TIMEOUT_HANGUP_PENDINGMO);
} catch (RemoteException e) {
}
|
public void | dispose()
if (DBG) log("dispose");
mRingingCall.dispose();
mBackgroundCall.dispose();
mForegroundCall.dispose();
mHandoverCall.dispose();
clearDisconnected();
mPhone.getContext().unregisterReceiver(mReceiver);
|
public void | dump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)
pw.println("ImsPhoneCallTracker extends:");
super.dump(fd, pw, args);
pw.println(" mVoiceCallEndedRegistrants=" + mVoiceCallEndedRegistrants);
pw.println(" mVoiceCallStartedRegistrants=" + mVoiceCallStartedRegistrants);
pw.println(" mRingingCall=" + mRingingCall);
pw.println(" mForegroundCall=" + mForegroundCall);
pw.println(" mBackgroundCall=" + mBackgroundCall);
pw.println(" mHandoverCall=" + mHandoverCall);
pw.println(" mPendingMO=" + mPendingMO);
//pw.println(" mHangupPendingMO=" + mHangupPendingMO);
pw.println(" mPhone=" + mPhone);
pw.println(" mDesiredMute=" + mDesiredMute);
pw.println(" mState=" + mState);
|
private void | dumpState()
List l;
log("Phone State:" + mState);
log("Ringing call: " + mRingingCall.toString());
l = mRingingCall.getConnections();
for (int i = 0, s = l.size(); i < s; i++) {
log(l.get(i).toString());
}
log("Foreground call: " + mForegroundCall.toString());
l = mForegroundCall.getConnections();
for (int i = 0, s = l.size(); i < s; i++) {
log(l.get(i).toString());
}
log("Background call: " + mBackgroundCall.toString());
l = mBackgroundCall.getConnections();
for (int i = 0, s = l.size(); i < s; i++) {
log(l.get(i).toString());
}
|
void | explicitCallTransfer()
//TODO : implement
|
protected void | finalize()
log("ImsPhoneCallTracker finalized");
|
private synchronized ImsPhoneConnection | findConnection(com.android.ims.ImsCall imsCall)
for (ImsPhoneConnection conn : mConnections) {
if (conn.getImsCall() == imsCall) {
return conn;
}
}
return null;
|
private int | getDisconnectCauseFromReasonInfo(com.android.ims.ImsReasonInfo reasonInfo)
int cause = DisconnectCause.ERROR_UNSPECIFIED;
//int type = reasonInfo.getReasonType();
int code = reasonInfo.getCode();
switch (code) {
case ImsReasonInfo.CODE_SIP_BAD_ADDRESS:
case ImsReasonInfo.CODE_SIP_NOT_REACHABLE:
return DisconnectCause.NUMBER_UNREACHABLE;
case ImsReasonInfo.CODE_SIP_BUSY:
return DisconnectCause.BUSY;
case ImsReasonInfo.CODE_USER_TERMINATED:
return DisconnectCause.LOCAL;
case ImsReasonInfo.CODE_LOCAL_CALL_DECLINE:
return DisconnectCause.INCOMING_REJECTED;
case ImsReasonInfo.CODE_USER_TERMINATED_BY_REMOTE:
return DisconnectCause.NORMAL;
case ImsReasonInfo.CODE_SIP_REDIRECTED:
case ImsReasonInfo.CODE_SIP_BAD_REQUEST:
case ImsReasonInfo.CODE_SIP_FORBIDDEN:
case ImsReasonInfo.CODE_SIP_NOT_ACCEPTABLE:
case ImsReasonInfo.CODE_SIP_USER_REJECTED:
case ImsReasonInfo.CODE_SIP_GLOBAL_ERROR:
return DisconnectCause.SERVER_ERROR;
case ImsReasonInfo.CODE_SIP_SERVICE_UNAVAILABLE:
case ImsReasonInfo.CODE_SIP_NOT_FOUND:
case ImsReasonInfo.CODE_SIP_SERVER_ERROR:
return DisconnectCause.SERVER_UNREACHABLE;
case ImsReasonInfo.CODE_LOCAL_NETWORK_ROAMING:
case ImsReasonInfo.CODE_LOCAL_NETWORK_IP_CHANGED:
case ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN:
case ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE:
case ImsReasonInfo.CODE_LOCAL_NOT_REGISTERED:
case ImsReasonInfo.CODE_LOCAL_NETWORK_NO_LTE_COVERAGE:
case ImsReasonInfo.CODE_LOCAL_NETWORK_NO_SERVICE:
case ImsReasonInfo.CODE_LOCAL_CALL_VCC_ON_PROGRESSING:
return DisconnectCause.OUT_OF_SERVICE;
case ImsReasonInfo.CODE_SIP_REQUEST_TIMEOUT:
case ImsReasonInfo.CODE_TIMEOUT_1XX_WAITING:
case ImsReasonInfo.CODE_TIMEOUT_NO_ANSWER:
case ImsReasonInfo.CODE_TIMEOUT_NO_ANSWER_CALL_UPDATE:
return DisconnectCause.TIMED_OUT;
case ImsReasonInfo.CODE_LOCAL_LOW_BATTERY:
case ImsReasonInfo.CODE_LOCAL_POWER_OFF:
return DisconnectCause.POWER_OFF;
default:
}
return cause;
|
com.android.ims.ImsEcbm | getEcbmInterface()
if (mImsManager == null) {
throw new ImsException("no ims manager", ImsReasonInfo.CODE_UNSPECIFIED);
}
ImsEcbm ecbm = mImsManager.getEcbmInterface(mServiceId);
return ecbm;
|
private void | getImsService()
if (DBG) log("getImsService");
mImsManager = ImsManager.getInstance(mPhone.getContext(), mPhone.getPhoneId());
try {
mServiceId = mImsManager.open(ImsServiceClass.MMTEL,
createIncomingCallPendingIntent(),
mImsConnectionStateListener);
// Get the ECBM interface and set IMSPhone's listener object for notifications
getEcbmInterface().setEcbmStateListener(mPhone.mImsEcbmStateListener);
if (mPhone.isInEcm()) {
// Call exit ECBM which will invoke onECBMExited
mPhone.exitEmergencyCallbackMode();
}
int mPreferredTtyMode = Settings.Secure.getInt(
mPhone.getContext().getContentResolver(),
Settings.Secure.PREFERRED_TTY_MODE,
Phone.TTY_MODE_OFF);
mImsManager.setUiTTYMode(mPhone.getContext(), mServiceId, mPreferredTtyMode, null);
} catch (ImsException e) {
loge("getImsService: " + e);
//Leave mImsManager as null, then CallStateException will be thrown when dialing
mImsManager = null;
}
|
boolean | getMute()
return mDesiredMute;
|
public PhoneConstants.State | getState()
return mState;
|
com.android.ims.ImsUtInterface | getUtInterface()
/* package */
if (mImsManager == null) {
throw new ImsException("no ims manager", ImsReasonInfo.CODE_UNSPECIFIED);
}
ImsUtInterface ut = mImsManager.getSupplementaryServiceConfiguration(mServiceId);
return ut;
|
private void | handleEcmTimer(int action)
mPhone.handleTimerInEmergencyCallbackMode(action);
switch (action) {
case ImsPhone.CANCEL_ECM_TIMER:
break;
case ImsPhone.RESTART_ECM_TIMER:
break;
default:
log("handleEcmTimer, unsupported action " + action);
}
|
public void | handleMessage(android.os.Message msg)
AsyncResult ar;
if (DBG) log("handleMessage what=" + msg.what);
switch (msg.what) {
case EVENT_HANGUP_PENDINGMO:
if (mPendingMO != null) {
mPendingMO.onDisconnect();
removeConnection(mPendingMO);
mPendingMO = null;
}
updatePhoneState();
mPhone.notifyPreciseCallStateChanged();
break;
case EVENT_RESUME_BACKGROUND:
try {
resumeWaitingOrHolding();
} catch (CallStateException e) {
if (Phone.DEBUG_PHONE) {
loge("handleMessage EVENT_RESUME_BACKGROUND exception=" + e);
}
}
break;
case EVENT_DIAL_PENDINGMO:
dialInternal(mPendingMO, mClirMode, VideoProfile.VideoState.AUDIO_ONLY);
break;
case EVENT_EXIT_ECM_RESPONSE_CDMA:
// no matter the result, we still do the same here
if (pendingCallInEcm) {
dialInternal(mPendingMO, pendingCallClirMode, pendingCallVideoState);
pendingCallInEcm = false;
}
mPhone.unsetOnEcbModeExitResponse(this);
break;
}
|
protected void | handlePollCalls(android.os.AsyncResult ar)
|
private void | handleRadioNotAvailable()
// handlePollCalls will clear out its
// call list when it gets the CommandException
// error result from this
pollCallsWhenSafe();
|
void | hangup(ImsPhoneConnection conn)
if (DBG) log("hangup connection");
if (conn.getOwner() != this) {
throw new CallStateException ("ImsPhoneConnection " + conn
+ "does not belong to ImsPhoneCallTracker " + this);
}
hangup(conn.getCall());
|
void | hangup(ImsPhoneCall call)
if (DBG) log("hangup call");
if (call.getConnections().size() == 0) {
throw new CallStateException("no connections");
}
ImsCall imsCall = call.getImsCall();
boolean rejectCall = false;
if (call == mRingingCall) {
if (Phone.DEBUG_PHONE) log("(ringing) hangup incoming");
rejectCall = true;
} else if (call == mForegroundCall) {
if (call.isDialingOrAlerting()) {
if (Phone.DEBUG_PHONE) {
log("(foregnd) hangup dialing or alerting...");
}
} else {
if (Phone.DEBUG_PHONE) {
log("(foregnd) hangup foreground");
}
//held call will be resumed by onCallTerminated
}
} else if (call == mBackgroundCall) {
if (Phone.DEBUG_PHONE) {
log("(backgnd) hangup waiting or background");
}
} else {
throw new CallStateException ("ImsPhoneCall " + call +
"does not belong to ImsPhoneCallTracker " + this);
}
call.onHangupLocal();
try {
if (imsCall != null) {
if (rejectCall) imsCall.reject(ImsReasonInfo.CODE_USER_DECLINE);
else imsCall.terminate(ImsReasonInfo.CODE_USER_TERMINATED);
} else if (mPendingMO != null && call == mForegroundCall) {
// is holding a foreground call
mPendingMO.update(null, ImsPhoneCall.State.DISCONNECTED);
mPendingMO.onDisconnect();
removeConnection(mPendingMO);
mPendingMO = null;
updatePhoneState();
removeMessages(EVENT_DIAL_PENDINGMO);
}
} catch (ImsException e) {
throw new CallStateException(e.getMessage());
}
mPhone.notifyPreciseCallStateChanged();
|
private void | internalClearDisconnected()
mRingingCall.clearDisconnected();
mForegroundCall.clearDisconnected();
mBackgroundCall.clearDisconnected();
mHandoverCall.clearDisconnected();
|
public boolean | isInEmergencyCall()
return mIsInEmergencyCall;
|
public boolean | isVolteEnabled()
return mIsVolteEnabled;
|
public boolean | isVtEnabled()
return mIsVtEnabled;
|
protected void | log(java.lang.String msg)
Rlog.d(LOG_TAG, "[ImsPhoneCallTracker] " + msg);
|
protected void | loge(java.lang.String msg)
Rlog.e(LOG_TAG, "[ImsPhoneCallTracker] " + msg);
|
void | notifySrvccState(Call.SrvccState state)
if (DBG) log("notifySrvccState state=" + state);
mSrvccState = state;
if (mSrvccState == Call.SrvccState.COMPLETED) {
transferHandoverConnections(mForegroundCall);
transferHandoverConnections(mBackgroundCall);
transferHandoverConnections(mRingingCall);
}
|
private void | processCallStateChange(com.android.ims.ImsCall imsCall, ImsPhoneCall.State state, int cause)
if (DBG) log("processCallStateChange " + imsCall + " state=" + state + " cause=" + cause);
if (imsCall == null) return;
boolean changed = false;
ImsPhoneConnection conn = findConnection(imsCall);
if (conn == null) {
// TODO : what should be done?
return;
}
changed = conn.update(imsCall, state);
if (state == ImsPhoneCall.State.DISCONNECTED) {
changed = conn.onDisconnect(cause) || changed;
//detach the disconnected connections
conn.getCall().detach(conn);
removeConnection(conn);
}
if (changed) {
if (conn.getCall() == mHandoverCall) return;
updatePhoneState();
mPhone.notifyPreciseCallStateChanged();
}
|
public void | registerForVoiceCallEnded(android.os.Handler h, int what, java.lang.Object obj)
Registrant r = new Registrant(h, what, obj);
mVoiceCallEndedRegistrants.add(r);
|
public void | registerForVoiceCallStarted(android.os.Handler h, int what, java.lang.Object obj)
Registrant r = new Registrant(h, what, obj);
mVoiceCallStartedRegistrants.add(r);
|
void | rejectCall()
if (DBG) log("rejectCall");
if (mRingingCall.getState().isRinging()) {
hangup(mRingingCall);
} else {
throw new CallStateException("phone not ringing");
}
|
private synchronized void | removeConnection(ImsPhoneConnection conn)
mConnections.remove(conn);
|
void | resumeWaitingOrHolding()
if (DBG) log("resumeWaitingOrHolding");
try {
if (mForegroundCall.getState().isAlive()) {
//resume foreground call after holding background call
//they were switched before holding
ImsCall imsCall = mForegroundCall.getImsCall();
if (imsCall != null) imsCall.resume();
} else if (mRingingCall.getState() == ImsPhoneCall.State.WAITING) {
//accept waiting call after holding background call
ImsCall imsCall = mRingingCall.getImsCall();
if (imsCall != null) imsCall.accept(ImsCallProfile.CALL_TYPE_VOICE);
} else {
//Just resume background call.
//To distinguish resuming call with swapping calls
//we do not switch calls.here
//ImsPhoneConnection.update will chnage the parent when completed
ImsCall imsCall = mBackgroundCall.getImsCall();
if (imsCall != null) imsCall.resume();
}
} catch (ImsException e) {
throw new CallStateException(e.getMessage());
}
|
void | sendDtmf(char c, android.os.Message result)
if (DBG) log("sendDtmf");
ImsCall imscall = mForegroundCall.getImsCall();
if (imscall != null) {
imscall.sendDtmf(c, result);
}
|
void | sendUSSD(java.lang.String ussdString, android.os.Message response)
if (DBG) log("sendUSSD");
try {
if (mUssdSession != null) {
mUssdSession.sendUssd(ussdString);
AsyncResult.forMessage(response, null, null);
response.sendToTarget();
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);
}
|
void | setMute(boolean mute)
mDesiredMute = mute;
mForegroundCall.setMute(mute);
|
void | setUiTTYMode(int uiTtyMode, android.os.Message onComplete)
try {
mImsManager.setUiTTYMode(mPhone.getContext(), mServiceId, uiTtyMode, onComplete);
} catch (ImsException e) {
loge("setTTYMode : " + e);
mPhone.sendErrorResponse(onComplete, e);
}
|
void | startDtmf(char c)
if (DBG) log("startDtmf");
ImsCall imscall = mForegroundCall.getImsCall();
if (imscall != null) {
imscall.startDtmf(c);
} else {
loge("startDtmf : no foreground call");
}
|
void | stopDtmf()
if (DBG) log("stopDtmf");
ImsCall imscall = mForegroundCall.getImsCall();
if (imscall != null) {
imscall.stopDtmf();
} else {
loge("stopDtmf : no foreground call");
}
|
void | switchWaitingOrHoldingAndActive()
if (DBG) log("switchWaitingOrHoldingAndActive");
if (mRingingCall.getState() == ImsPhoneCall.State.INCOMING) {
throw new CallStateException("cannot be in the incoming state");
}
if (mForegroundCall.getState() == ImsPhoneCall.State.ACTIVE) {
ImsCall imsCall = mForegroundCall.getImsCall();
if (imsCall == null) {
throw new CallStateException("no ims call");
}
// Swap the ImsCalls pointed to by the foreground and background ImsPhoneCalls.
// If hold or resume later fails, we will swap them back.
mSwitchingFgAndBgCalls = true;
mCallExpectedToResume = mBackgroundCall.getImsCall();
mForegroundCall.switchWith(mBackgroundCall);
// Hold the foreground call; once the foreground call is held, the background call will
// be resumed.
try {
imsCall.hold();
} catch (ImsException e) {
mForegroundCall.switchWith(mBackgroundCall);
throw new CallStateException(e.getMessage());
}
} else if (mBackgroundCall.getState() == ImsPhoneCall.State.HOLDING) {
resumeWaitingOrHolding();
}
|
private void | transferHandoverConnections(ImsPhoneCall call)
if (call.mConnections != null) {
for (Connection c : call.mConnections) {
c.mPreHandoverState = call.mState;
log ("Connection state before handover is " + c.getStateBeforeHandover());
}
}
if (mHandoverCall.mConnections == null ) {
mHandoverCall.mConnections = call.mConnections;
} else { // Multi-call SRVCC
mHandoverCall.mConnections.addAll(call.mConnections);
}
if (mHandoverCall.mConnections != null) {
if (call.getImsCall() != null) {
call.getImsCall().close();
}
for (Connection c : mHandoverCall.mConnections) {
((ImsPhoneConnection)c).changeParent(mHandoverCall);
((ImsPhoneConnection)c).releaseWakeLock();
}
}
if (call.getState().isAlive()) {
log ("Call is alive and state is " + call.mState);
mHandoverCall.mState = call.mState;
}
call.mConnections.clear();
call.mState = ImsPhoneCall.State.IDLE;
|
public void | unregisterForVoiceCallEnded(android.os.Handler h)
mVoiceCallEndedRegistrants.remove(h);
|
public void | unregisterForVoiceCallStarted(android.os.Handler h)
mVoiceCallStartedRegistrants.remove(h);
|
private void | updatePhoneState()
PhoneConstants.State oldState = mState;
if (mRingingCall.isRinging()) {
mState = PhoneConstants.State.RINGING;
} else if (mPendingMO != null ||
!(mForegroundCall.isIdle() && mBackgroundCall.isIdle())) {
mState = PhoneConstants.State.OFFHOOK;
} else {
mState = PhoneConstants.State.IDLE;
}
if (mState == PhoneConstants.State.IDLE && oldState != mState) {
mVoiceCallEndedRegistrants.notifyRegistrants(
new AsyncResult(null, null, null));
} else if (oldState == PhoneConstants.State.IDLE && oldState != mState) {
mVoiceCallStartedRegistrants.notifyRegistrants (
new AsyncResult(null, null, null));
}
if (DBG) log("updatePhoneState oldState=" + oldState + ", newState=" + mState);
if (mState != oldState) {
mPhone.notifyPhoneStateChanged();
}
|