public class CallManager extends Object
Modifier and Type | Method and Description |
---|---|
void |
acceptCall(Call ringingCall)
Answers a ringing or waiting call.
|
boolean |
canConference(Call heldCall)
Whether or not the phone can conference in the current phone
state--that is, one call holding and one call active.
|
boolean |
canConference(Call heldCall,
int subId)
Whether or not the phone can conference in the current phone
state--that is, one call holding and one call active.
|
boolean |
canTransfer(Call heldCall)
Whether or not the phone can do explicit call transfer in the current
phone state--that is, one call holding and one call active.
|
boolean |
canTransfer(Call heldCall,
int subId)
Whether or not the phone specific to subId can do explicit call transfer
in the current phone state--that is, one call holding and one call active.
|
void |
clearDisconnected()
clear disconnect connection for each phone
|
void |
clearDisconnected(int subId)
clear disconnect connection for a phone specific
to the provided subId
|
void |
conference(Call heldCall)
Conferences holding and active.
|
Connection |
dial(Phone phone,
String dialString,
int videoState)
Initiate a new voice connection.
|
Connection |
dial(Phone phone,
String dialString,
UUSInfo uusInfo,
int videoState)
Initiate a new voice connection.
|
void |
explicitCallTransfer(Call heldCall)
Connects the held call and active call
Disconnects the subscriber from both calls
Explicit Call Transfer occurs asynchronously
and may fail.
|
Call |
getActiveFgCall()
return the active foreground call from foreground calls
Active call means the call is NOT in Call.State.IDLE
1.
|
Call |
getActiveFgCall(int subId) |
Call.State |
getActiveFgCallState() |
Call.State |
getActiveFgCallState(int subId) |
List<Phone> |
getAllPhones()
Returns all the registered phone objects.
|
List<Call> |
getBackgroundCalls() |
List<Connection> |
getBgCallConnections() |
List<Connection> |
getBgCallConnections(int subId) |
Phone |
getBgPhone() |
Phone |
getBgPhone(int subId) |
Phone |
getDefaultPhone()
return the default phone or null if no phone available
|
List<Connection> |
getFgCallConnections() |
List<Connection> |
getFgCallConnections(int subId) |
Connection |
getFgCallLatestConnection() |
Connection |
getFgCallLatestConnection(int subId) |
Phone |
getFgPhone() |
Phone |
getFgPhone(int subId) |
Call |
getFirstActiveBgCall()
return one active background call from background calls
Active call means the call is NOT idle defined by Call.isIdle()
1.
|
Call |
getFirstActiveBgCall(int subId)
return one active background call from background calls of the
requested subId.
|
Call |
getFirstActiveRingingCall()
return one active ringing call from ringing calls
Active call means the call is NOT idle defined by Call.isIdle()
1.
|
Call |
getFirstActiveRingingCall(int subId) |
List<Call> |
getForegroundCalls() |
static CallManager |
getInstance()
get singleton instance of CallManager
|
boolean |
getMute()
Gets current mute status.
|
List<? extends MmiCode> |
getPendingMmiCodes(Phone phone)
Returns a list of MMI codes that are pending for a phone.
|
Phone |
getPhoneInCall() |
Phone |
getPhoneInCall(int subId) |
Object |
getRegistrantIdentifier() |
List<Call> |
getRingingCalls() |
Phone |
getRingingPhone() |
Phone |
getRingingPhone(int subId) |
int |
getServiceState() |
int |
getServiceState(int subId) |
PhoneConstants.State |
getState()
Get current coarse-grained voice call state.
|
PhoneConstants.State |
getState(int subId)
Get current coarse-grained voice call state on a subId.
|
void |
hangupForegroundResumeBackground(Call heldCall)
Hangup foreground call and resume the specific background call
Note: this is noop if there is no foreground call or the heldCall is null
|
boolean |
hasActiveBgCall()
Return true if there is at least one active background call
|
boolean |
hasActiveBgCall(int subId)
Return true if there is at least one active background call
on a particular subId or an active sip call
|
boolean |
hasActiveFgCall()
Return true if there is at least one active foreground call
|
boolean |
hasActiveFgCall(int subId)
Return true if there is at least one active foreground call
on a particular subId or an active sip call
|
boolean |
hasActiveRingingCall()
Return true if there is at least one active ringing call
|
boolean |
hasActiveRingingCall(int subId)
Return true if there is at least one active ringing call
|
boolean |
hasDisconnectedBgCall() |
boolean |
hasDisconnectedBgCall(int subId) |
boolean |
hasDisconnectedFgCall() |
boolean |
hasDisconnectedFgCall(int subId) |
void |
registerForCallWaiting(Handler h,
int what,
Object obj)
Register for notifications when CDMA call waiting comes
|
void |
registerForCdmaOtaStatusChange(Handler h,
int what,
Object obj)
Register for notifications when CDMA OTA Provision status change
|
void |
registerForDisconnect(Handler h,
int what,
Object obj)
Notifies when a voice connection has disconnected, either due to local
or remote hangup or error.
|
void |
registerForDisplayInfo(Handler h,
int what,
Object obj)
Register for display information notifications from the network.
|
void |
registerForEcmTimerReset(Handler h,
int what,
Object obj)
Registration point for Ecm timer reset
|
void |
registerForInCallVoicePrivacyOff(Handler h,
int what,
Object obj)
Register for notifications when a sInCall VoicePrivacy is disabled
|
void |
registerForInCallVoicePrivacyOn(Handler h,
int what,
Object obj)
Register for notifications when a sInCall VoicePrivacy is enabled
|
void |
registerForIncomingRing(Handler h,
int what,
Object obj)
Notifies when an incoming call rings.
|
void |
registerForMmiComplete(Handler h,
int what,
Object obj)
Register for notifications that an MMI request has completed
its network activity and is in its final state.
|
void |
registerForMmiInitiate(Handler h,
int what,
Object obj)
Register for notifications of initiation of a new MMI code request.
|
void |
registerForNewRingingConnection(Handler h,
int what,
Object obj)
Notifies when a new ringing or waiting connection has appeared.
|
void |
registerForOnHoldTone(Handler h,
int what,
Object obj)
Notifies when out-band on-hold tone is needed.
|
void |
registerForPostDialCharacter(Handler h,
int what,
Object obj)
Sets an event to be fired when the telephony system processes
a post-dial character on an outgoing call.
|
void |
registerForPreciseCallStateChanged(Handler h,
int what,
Object obj)
Register for getting notifications for change in the Call State
Call.State
This is called PreciseCallState because the call state is more precise than what
can be obtained using the PhoneStateListener
Resulting events will have an AsyncResult in Message.obj . |
void |
registerForResendIncallMute(Handler h,
int what,
Object obj)
Registers the handler to reset the uplink mute state to get
uplink audio.
|
void |
registerForRingbackTone(Handler h,
int what,
Object obj)
Notifies when out-band ringback tone is needed.
|
void |
registerForServiceStateChanged(Handler h,
int what,
Object obj)
Register for ServiceState changed.
|
void |
registerForSignalInfo(Handler h,
int what,
Object obj)
Register for signal information notifications from the network.
|
void |
registerForSubscriptionInfoReady(Handler h,
int what,
Object obj)
Registration point for subscription info ready
|
void |
registerForSuppServiceFailed(Handler h,
int what,
Object obj)
Register for notifications when a supplementary service attempt fails.
|
void |
registerForTtyModeReceived(Handler h,
int what,
Object obj)
Register for TTY mode change notifications from the network.
|
void |
registerForUnknownConnection(Handler h,
int what,
Object obj)
Notifies when a previously untracked non-ringing/waiting connection has appeared.
|
boolean |
registerPhone(Phone phone)
Register phone to CallManager
|
void |
rejectCall(Call ringingCall)
Reject (ignore) a ringing call.
|
boolean |
sendBurstDtmf(String dtmfString,
int on,
int off,
Message onComplete)
send burst DTMF tone, it can send the string as single character or multiple character
ignore if there is no active call or not valid digits string.
|
boolean |
sendDtmf(char c)
Play a DTMF tone on the active call.
|
boolean |
sendUssdResponse(Phone phone,
String ussdMessge)
Sends user response to a USSD REQUEST message.
|
void |
setEchoSuppressionEnabled()
Enables or disables echo suppression.
|
void |
setMute(boolean muted)
Mutes or unmutes the microphone for the active call.
|
boolean |
startDtmf(char c)
Start to paly a DTMF tone on the active call.
|
void |
stopDtmf()
Stop the playing DTMF tone.
|
void |
switchHoldingAndActive(Call heldCall)
Places active call on hold, and makes held call active.
|
String |
toString()
Returns a string representation of the object.
|
void |
unregisterForCallWaiting(Handler h)
Unregister for notifications when CDMA Call waiting comes
|
void |
unregisterForCdmaOtaStatusChange(Handler h)
Unregister for notifications when CDMA OTA Provision status change
|
void |
unregisterForDisconnect(Handler h)
Unregisters for voice disconnection notification.
|
void |
unregisterForDisplayInfo(Handler h)
Unregisters for display information notifications.
|
void |
unregisterForEcmTimerReset(Handler h)
Unregister for notification for Ecm timer reset
|
void |
unregisterForInCallVoicePrivacyOff(Handler h)
Unregister for notifications when a sInCall VoicePrivacy is disabled
|
void |
unregisterForInCallVoicePrivacyOn(Handler h)
Unregister for notifications when a sInCall VoicePrivacy is enabled
|
void |
unregisterForIncomingRing(Handler h)
Unregisters for ring notification.
|
void |
unregisterForMmiComplete(Handler h)
Unregisters for MMI complete notification.
|
void |
unregisterForMmiInitiate(Handler h)
Unregisters for new MMI initiate notification.
|
void |
unregisterForNewRingingConnection(Handler h)
Unregisters for new ringing connection notification.
|
void |
unregisterForOnHoldTone(Handler h)
Unregisters for on-hold tone notification.
|
void |
unregisterForPostDialCharacter(Handler h) |
void |
unregisterForPreciseCallStateChanged(Handler h)
Unregisters for voice call state change notifications.
|
void |
unregisterForResendIncallMute(Handler h)
Unregisters for resend incall mute notifications.
|
void |
unregisterForRingbackTone(Handler h)
Unregisters for ringback tone notification.
|
void |
unregisterForServiceStateChanged(Handler h)
Unregisters for ServiceStateChange notification.
|
void |
unregisterForSignalInfo(Handler h)
Unregisters for signal information notifications.
|
void |
unregisterForSubscriptionInfoReady(Handler h)
Unregister for notifications for subscription info
|
void |
unregisterForSuppServiceFailed(Handler h)
Unregister for notifications when a supplementary service attempt fails.
|
void |
unregisterForTtyModeReceived(Handler h)
Unregisters for TTY mode change notifications.
|
void |
unregisterForUnknownConnection(Handler h)
Unregisters for unknown connection notifications.
|
void |
unregisterPhone(Phone phone)
unregister phone from CallManager
|
protected final RegistrantList mPreciseCallStateRegistrants
protected final RegistrantList mNewRingingConnectionRegistrants
protected final RegistrantList mIncomingRingRegistrants
protected final RegistrantList mDisconnectRegistrants
protected final RegistrantList mMmiRegistrants
protected final RegistrantList mUnknownConnectionRegistrants
protected final RegistrantList mRingbackToneRegistrants
protected final RegistrantList mOnHoldToneRegistrants
protected final RegistrantList mInCallVoicePrivacyOnRegistrants
protected final RegistrantList mInCallVoicePrivacyOffRegistrants
protected final RegistrantList mCallWaitingRegistrants
protected final RegistrantList mDisplayInfoRegistrants
protected final RegistrantList mSignalInfoRegistrants
protected final RegistrantList mCdmaOtaStatusChangeRegistrants
protected final RegistrantList mResendIncallMuteRegistrants
protected final RegistrantList mMmiInitiateRegistrants
protected final RegistrantList mMmiCompleteRegistrants
protected final RegistrantList mEcmTimerResetRegistrants
protected final RegistrantList mSubscriptionInfoReadyRegistrants
protected final RegistrantList mSuppServiceFailedRegistrants
protected final RegistrantList mServiceStateChangedRegistrants
protected final RegistrantList mPostDialCharacterRegistrants
protected final RegistrantList mTtyModeReceivedRegistrants
public static CallManager getInstance()
public List<Phone> getAllPhones()
public PhoneConstants.State getState()
public PhoneConstants.State getState(int subId)
public int getServiceState()
public int getServiceState(int subId)
public Phone getPhoneInCall()
public Phone getPhoneInCall(int subId)
public boolean registerPhone(Phone phone)
phone
- to be registeredpublic void unregisterPhone(Phone phone)
phone
- to be unregisteredpublic Phone getDefaultPhone()
public Phone getFgPhone()
public Phone getFgPhone(int subId)
public Phone getBgPhone()
public Phone getBgPhone(int subId)
public Phone getRingingPhone()
public Phone getRingingPhone(int subId)
public Object getRegistrantIdentifier()
public void acceptCall(Call ringingCall) throws CallStateException
registerForPreciseCallStateChanged()
.CallStateException
- when call is not ringing or waitingpublic void rejectCall(Call ringingCall) throws CallStateException
registerForPreciseCallStateChanged()
.CallStateException
- when no call is ringing or waitingpublic void switchHoldingAndActive(Call heldCall) throws CallStateException
registerForPreciseCallStateChanged()
.CallStateException
- if active call is ringing, waiting, or
dialing/alerting, or heldCall can't be active.
In these cases, this operation may not be performed.public void hangupForegroundResumeBackground(Call heldCall) throws CallStateException
heldCall
- to become foregroundCallStateException
public boolean canConference(Call heldCall)
public boolean canConference(Call heldCall, int subId)
public void conference(Call heldCall) throws CallStateException
registerForPreciseCallStateChanged()
.CallStateException
- if canConference() would return false.
In these cases, this operation may not be performed.public Connection dial(Phone phone, String dialString, int videoState) throws CallStateException
CallStateException
- if a new outgoing call is not currently
possible because no more call slots exist or a call exists that is
dialing, alerting, ringing, or waiting. Other errors are
handled asynchronously.public Connection dial(Phone phone, String dialString, UUSInfo uusInfo, int videoState) throws CallStateException
CallStateException
- if a new outgoing call is not currently
possible because no more call slots exist or a call exists that is
dialing, alerting, ringing, or waiting. Other errors are
handled asynchronously.public void clearDisconnected()
public void clearDisconnected(int subId)
public boolean canTransfer(Call heldCall)
public boolean canTransfer(Call heldCall, int subId)
public void explicitCallTransfer(Call heldCall) throws CallStateException
registerForPreciseCallStateChanged()
.CallStateException
- if canTransfer() would return false.
In these cases, this operation may not be performed.public List<? extends MmiCode> getPendingMmiCodes(Phone phone)
registerForMmiInitiate
and registerForMmiComplete
for change notification.public boolean sendUssdResponse(Phone phone, String ussdMessge)
ussdMessge
- Message to send in the response.public void setMute(boolean muted)
muted
- true to mute the microphone,
false to activate the microphone.public boolean getMute()
registerForPreciseCallStateChanged()
as a change notifcation, although presently phone state changed is not
fired when setMute() is called.public void setEchoSuppressionEnabled()
public boolean sendDtmf(char c)
c
- should be one of 0-9, '*' or '#'. Other values will be
silently ignored.public boolean startDtmf(char c)
c
- should be one of 0-9, '*' or '#'. Other values will be
silently ignored.public void stopDtmf()
public boolean sendBurstDtmf(String dtmfString, int on, int off, Message onComplete)
dtmfString
- is string representing the dialing digit(s) in the active callon
- the DTMF ON length in milliseconds, or 0 for defaultoff
- the DTMF OFF length in milliseconds, or 0 for defaultonComplete
- is the callback message when the action is processed by BPpublic void registerForDisconnect(Handler h, int what, Object obj)
public void unregisterForDisconnect(Handler h)
public void registerForPreciseCallStateChanged(Handler h, int what, Object obj)
Call.State
This is called PreciseCallState because the call state is more precise than what
can be obtained using the PhoneStateListener
Resulting events will have an AsyncResult in Message.obj
.
AsyncResult.userData will be set to the obj argument here.
The h parameter is held only by a weak reference.public void unregisterForPreciseCallStateChanged(Handler h)
public void registerForUnknownConnection(Handler h, int what, Object obj)
public void unregisterForUnknownConnection(Handler h)
public void registerForNewRingingConnection(Handler h, int what, Object obj)
Messages received from this: Message.obj will be an AsyncResult AsyncResult.userObj = obj AsyncResult.result = a Connection.
Please check Connection.isRinging() to make sure the Connection has not dropped since this message was posted. If Connection.isRinging() is true, then Connection.getCall() == Phone.getRingingCall()
public void unregisterForNewRingingConnection(Handler h)
public void registerForIncomingRing(Handler h, int what, Object obj)
Messages received from this: Message.obj will be an AsyncResult AsyncResult.userObj = obj AsyncResult.result = a Connection.
public void unregisterForIncomingRing(Handler h)
public void registerForRingbackTone(Handler h, int what, Object obj)
Messages received from this: Message.obj will be an AsyncResult AsyncResult.userObj = obj AsyncResult.result = boolean, true to start play ringback tone and false to stop.
public void unregisterForRingbackTone(Handler h)
public void registerForOnHoldTone(Handler h, int what, Object obj)
Messages received from this: Message.obj will be an AsyncResult AsyncResult.userObj = obj AsyncResult.result = boolean, true to start play on-hold tone and false to stop.
public void unregisterForOnHoldTone(Handler h)
public void registerForResendIncallMute(Handler h, int what, Object obj)
public void unregisterForResendIncallMute(Handler h)
public void registerForMmiInitiate(Handler h, int what, Object obj)
Example: If Phone.dial is called with "*#31#", then the app will be notified here.
The returned Message.obj
will contain an AsyncResult.
obj.result
will be an "MmiCode" object.
public void unregisterForMmiInitiate(Handler h)
public void registerForMmiComplete(Handler h, int what, Object obj)
Message.obj
will contain an AsyncResult.
obj.result
will be an "MmiCode" objectpublic void unregisterForMmiComplete(Handler h)
public void registerForEcmTimerReset(Handler h, int what, Object obj)
h
- handler to notifywhat
- user-defined message codeobj
- placed in Message.objpublic void unregisterForEcmTimerReset(Handler h)
h
- Handler to be removed from the registrant list.public void registerForServiceStateChanged(Handler h, int what, Object obj)
public void unregisterForServiceStateChanged(Handler h)
public void registerForSuppServiceFailed(Handler h, int what, Object obj)
h
- Handler that receives the notification message.what
- User-defined message code.obj
- User object.public void unregisterForSuppServiceFailed(Handler h)
h
- Handler to be removed from the registrant list.public void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj)
h
- Handler that receives the notification message.what
- User-defined message code.obj
- User object.public void unregisterForInCallVoicePrivacyOn(Handler h)
h
- Handler to be removed from the registrant list.public void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj)
h
- Handler that receives the notification message.what
- User-defined message code.obj
- User object.public void unregisterForInCallVoicePrivacyOff(Handler h)
h
- Handler to be removed from the registrant list.public void registerForCallWaiting(Handler h, int what, Object obj)
h
- Handler that receives the notification message.what
- User-defined message code.obj
- User object.public void unregisterForCallWaiting(Handler h)
h
- Handler to be removed from the registrant list.public void registerForSignalInfo(Handler h, int what, Object obj)
h
- Handler that receives the notification message.what
- User-defined message code.obj
- User object.public void unregisterForSignalInfo(Handler h)
h
- Handler to be removed from the registrant list.public void registerForDisplayInfo(Handler h, int what, Object obj)
h
- Handler that receives the notification message.what
- User-defined message code.obj
- User object.public void unregisterForDisplayInfo(Handler h)
h
- Handler to be removed from the registrant list.public void registerForCdmaOtaStatusChange(Handler h, int what, Object obj)
h
- Handler that receives the notification message.what
- User-defined message code.obj
- User object.public void unregisterForCdmaOtaStatusChange(Handler h)
h
- Handler to be removed from the registrant list.public void registerForSubscriptionInfoReady(Handler h, int what, Object obj)
h
- handler to notifywhat
- what code of message when deliveredobj
- placed in Message.objpublic void unregisterForSubscriptionInfoReady(Handler h)
h
- Handler to be removed from the registrant list.public void registerForPostDialCharacter(Handler h, int what, Object obj)
Messages of type what
will be sent to h
.
The obj
field of these Message's will be instances of
AsyncResult
. Message.obj.result
will be
a Connection object.
Message.arg1 will be the post dial character being processed, or 0 ('\0') if end of string.
If Connection.getPostDialState() == WAIT,
the application must call
Connection.proceedAfterWaitChar()
or
Connection.cancelPostDial()
for the telephony system to continue playing the post-dial
DTMF sequence.
If Connection.getPostDialState() == WILD,
the application must call
Connection.proceedAfterWildChar()
or
Connection.cancelPostDial()
for the telephony system to continue playing the
post-dial DTMF sequence.
public void unregisterForPostDialCharacter(Handler h)
public void registerForTtyModeReceived(Handler h, int what, Object obj)
h
- Handler that receives the notification message.what
- User-defined message code.obj
- User object.public void unregisterForTtyModeReceived(Handler h)
h
- Handler to be removed from the registrant list.public boolean hasActiveFgCall()
public boolean hasActiveFgCall(int subId)
public boolean hasActiveBgCall()
public boolean hasActiveBgCall(int subId)
public boolean hasActiveRingingCall()
public boolean hasActiveRingingCall(int subId)
public Call getActiveFgCall()
public Call getActiveFgCall(int subId)
public Call getFirstActiveBgCall()
public Call getFirstActiveBgCall(int subId)
public Call getFirstActiveRingingCall()
public Call getFirstActiveRingingCall(int subId)
public Call.State getActiveFgCallState()
public Call.State getActiveFgCallState(int subId)
public List<Connection> getFgCallConnections()
public List<Connection> getFgCallConnections(int subId)
public List<Connection> getBgCallConnections()
public List<Connection> getBgCallConnections(int subId)
public Connection getFgCallLatestConnection()
public Connection getFgCallLatestConnection(int subId)
public boolean hasDisconnectedFgCall()
public boolean hasDisconnectedFgCall(int subId)
public boolean hasDisconnectedBgCall()
public boolean hasDisconnectedBgCall(int subId)
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())