public class ImsCall extends Object implements ICall
ImsManager
.Modifier and Type | Class and Description |
---|---|
class |
ImsCall.ImsCallSessionListenerProxy |
static class |
ImsCall.Listener
Listener for events relating to an IMS call, such as when a call is being
received ("on ringing") or a call is outgoing ("on calling").
|
Modifier and Type | Field and Description |
---|---|
int |
uniqueId
Unique identifier.
|
static int |
USSD_MODE_NOTIFY |
static int |
USSD_MODE_REQUEST |
Constructor and Description |
---|
ImsCall(Context context,
ImsCallProfile profile)
Create an IMS call object.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(int callType)
Accepts a call.
|
void |
accept(int callType,
ImsStreamMediaProfile profile)
Accepts a call.
|
void |
attachSession(ImsCallSession session)
Attaches an incoming call to this call object.
|
boolean |
checkIfRemoteUserIsSame(String userId)
Checks if the call has a same remote user identity or not.
|
void |
close()
Closes this object.
|
void |
conferenceStateUpdated(ImsConferenceState state)
Report a new conference state to the current
ImsCall and inform listeners of the
change. |
boolean |
equalsTo(ICall call)
Checks if the call is equal or not.
|
void |
extendToConference(String[] participants)
Extends this call (1-to-1 call) to the conference call
inviting the specified participants to.
|
String |
getCallExtra(String name)
Gets the specified property of this call.
|
ImsCallProfile |
getCallProfile()
Gets the negotiated (local & remote) call profile.
|
ImsCallSession |
getCallSession()
Gets the
ImsCallSession that carries this call. |
List<ConferenceParticipant> |
getConferenceParticipants()
Gets the list of conference participants currently
associated with this call.
|
ImsCall.ImsCallSessionListenerProxy |
getImsCallSessionListenerProxy() |
ImsReasonInfo |
getLastReasonInfo()
Gets the last reason information when the call is not established, cancelled or terminated.
|
ImsCallProfile |
getLocalCallProfile()
Gets the local call profile (local capabilities).
|
ImsStreamMediaSession |
getMediaSession()
Gets the
ImsStreamMediaSession that handles the media operation of this call. |
ImsCallProfile |
getProposedCallProfile()
Gets the call profile proposed by the local/remote user.
|
ImsCallProfile |
getRemoteCallProfile()
Gets the remote call profile (remote capabilities).
|
ImsCallSession |
getSession()
Returns current ImsCallSession
|
int |
getState()
Gets the state of the
ImsCallSession that carries this call. |
boolean |
hasPendingUpdate()
Checks if the call has a pending update operation.
|
void |
hold()
Puts a call on hold.
|
void |
inviteParticipants(String[] participants)
Requests the conference server to invite an additional participants to the conference.
|
boolean |
isConferenceHost()
|
boolean |
isInCall()
Checks if the call is established.
|
boolean |
isMerged() |
boolean |
isMergeRequestedByConf()
Checks if the merge was requested by foreground conference call
|
boolean |
isMultiparty()
Determines if the call is a multiparty call.
|
boolean |
isMuted()
Checks if the call is muted.
|
boolean |
isOnHold()
Checks if the call is on hold.
|
boolean |
isPendingHold()
Checks if the call is pending a hold operation.
|
static boolean |
isSessionAlive(ImsCallSession session) |
boolean |
isVideoCall() |
boolean |
isWifiCall()
Determines if the current call radio access technology is over WIFI.
|
void |
merge(ImsCall bgCall)
Merges the active & hold call.
|
void |
reject(int reason)
Rejects a call.
|
void |
removeParticipants(String[] participants)
Requests the conference server to remove the specified participants from the conference.
|
void |
resetIsMergeRequestedByConf(boolean value)
Resets the flag which indicates merge request was sent by
foreground conference call
|
void |
resume()
Continues a call that's on hold.
|
void |
sendDtmf(char c,
Message result)
Sends a DTMF code.
|
void |
sendUssd(String ussdMessage)
Sends an USSD message.
|
void |
setIsMerged(boolean isMerged)
Marks whether an IMS call is merged.
|
void |
setListener(ImsCall.Listener listener)
Sets the listener to listen to the IMS call events.
|
void |
setListener(ImsCall.Listener listener,
boolean callbackImmediately)
Sets the listener to listen to the IMS call events.
|
void |
setMergeHost(ImsCall mergeHost)
Sets the merge hody for the current call.
|
void |
setMute(boolean muted)
Mutes or unmutes the mic for the active call.
|
void |
start(ImsCallSession session,
String callee)
Initiates an IMS call with the call profile which is provided
when creating a
ImsCall . |
void |
start(ImsCallSession session,
String[] participants)
Initiates an IMS conferenca call with the call profile which is provided
when creating a
ImsCall . |
void |
startDtmf(char c)
Start a DTMF code.
|
void |
stopDtmf()
Stop a DTMF code.
|
void |
terminate(int reason)
Terminates an IMS call (e.g. user initiated).
|
void |
terminate(int reason,
int overrideReason) |
String |
toString()
Provides a string representation of the
ImsCall . |
void |
update(int callType,
ImsStreamMediaProfile mediaProfile)
Updates the current call's properties (ex. call mode change: video upgrade / downgrade).
|
boolean |
wasVideoCall() |
public static final int USSD_MODE_NOTIFY
public static final int USSD_MODE_REQUEST
public final int uniqueId
public ImsCall(Context context, ImsCallProfile profile)
context
- the context for accessing system servicesprofile
- the call profile to make/take a callpublic void close()
public boolean checkIfRemoteUserIsSame(String userId)
checkIfRemoteUserIsSame
in interface ICall
userId
- the remote user identitypublic boolean equalsTo(ICall call)
public static boolean isSessionAlive(ImsCallSession session)
public ImsCallProfile getCallProfile()
ImsCallProfile
object that has the negotiated call profilepublic ImsCallProfile getLocalCallProfile() throws ImsException
ImsCallProfile
object that has the local call profileImsException
public ImsCallProfile getRemoteCallProfile() throws ImsException
ImsCallProfile
object that has the remote call profileImsException
public ImsCallProfile getProposedCallProfile()
ImsCallProfile
object that has the proposed call profilepublic List<ConferenceParticipant> getConferenceParticipants()
public int getState()
ImsCallSession
that carries this call.
The value returned must be one of the states in ImsCallSession#State
.public ImsCallSession getCallSession()
ImsCallSession
that carries this call.public ImsStreamMediaSession getMediaSession()
ImsStreamMediaSession
that handles the media operation of this call.
Almost interface APIs are for the VT (Video Telephony).public String getCallExtra(String name) throws ImsException
name
- key to get the extra call information defined in ImsCallProfile
ImsException
public ImsReasonInfo getLastReasonInfo()
public boolean hasPendingUpdate()
public boolean isPendingHold()
public boolean isInCall()
public boolean isMuted()
public boolean isOnHold()
public boolean isMultiparty()
True
if the call is a multiparty call.public boolean isConferenceHost()
isMultiparty()
is true
, determines if this ImsCall
is the
origin of the conference call (i.e. #isConferenceHost()
is true
), or if this
ImsCall
is a member of a conference hosted on another device.true
if this call is the origin of the conference call it is a member of,
false
otherwise.public void setIsMerged(boolean isMerged)
true
when the call merges
into a conference.isMerged
- Whether the call is merged.public boolean isMerged()
true
if the call recently merged into a conference call.public void setListener(ImsCall.Listener listener)
setListener(listener, false)
.listener
- to listen to the IMS call events of this object; null to remove listenersetListener(Listener, boolean)
public void setListener(ImsCall.Listener listener, boolean callbackImmediately)
ImsCall
can only hold one listener at a time. Subsequent calls
to this method override the previous listener.listener
- to listen to the IMS call events of this object; null to remove listenercallbackImmediately
- set to true if the caller wants to be called
back immediately on the current statepublic void setMute(boolean muted) throws ImsException
muted
- true if the call is muted, false otherwiseImsException
public void attachSession(ImsCallSession session) throws ImsException
session
- the session that receives the incoming callImsException
- if the IMS service fails to attach this object to the sessionpublic void start(ImsCallSession session, String callee) throws ImsException
ImsCall
.session
- the ImsCallSession
for carrying out the callcallee
- callee information to initiate an IMS callImsException
- if the IMS service fails to initiate the callpublic void start(ImsCallSession session, String[] participants) throws ImsException
ImsCall
.session
- the ImsCallSession
for carrying out the callparticipants
- participant list to initiate an IMS conference callImsException
- if the IMS service fails to initiate the callpublic void accept(int callType) throws ImsException
callType
- The call type the user agreed to for accepting the call.ImsException
- if the IMS service fails to accept the callImsCall.Listener.onCallStarted(com.android.ims.ImsCall)
public void accept(int callType, ImsStreamMediaProfile profile) throws ImsException
callType
- call type to be answered in ImsCallProfile
profile
- a media profile to be answered (audio/audio & video, direction, ...)ImsException
- if the IMS service fails to accept the callImsCall.Listener.onCallStarted(com.android.ims.ImsCall)
public void reject(int reason) throws ImsException
reason
- reason code to reject an incoming callImsException
- if the IMS service fails to reject the callImsCall.Listener.onCallStartFailed(com.android.ims.ImsCall, com.android.ims.ImsReasonInfo)
public void terminate(int reason, int overrideReason) throws ImsException
ImsException
public void terminate(int reason) throws ImsException
reason
- reason code to terminate a callImsException
- if the IMS service fails to terminate the callpublic void hold() throws ImsException
ImsCall.Listener.onCallHeld(com.android.ims.ImsCall)
is called.ImsException
- if the IMS service fails to hold the callListener#onCallHeld, Listener#onCallHoldFailed
public void resume() throws ImsException
ImsCall.Listener.onCallResumed(com.android.ims.ImsCall)
is called.ImsException
- if the IMS service fails to resume the callListener#onCallResumed, Listener#onCallResumeFailed
public void merge(ImsCall bgCall) throws ImsException
bgCall
- the background (holding) callImsException
- if the IMS service fails to merge the callListener#onCallMerged, Listener#onCallMergeFailed
public void update(int callType, ImsStreamMediaProfile mediaProfile) throws ImsException
ImsException
public void extendToConference(String[] participants) throws ImsException
ImsException
public void inviteParticipants(String[] participants) throws ImsException
ImsException
public void removeParticipants(String[] participants) throws ImsException
ImsException
public void sendDtmf(char c, Message result)
c
- that represents the DTMF to send. '0' ~ '9', 'A' ~ 'D', '*', '#' are valid inputs.result
- the result message to send when done.public void startDtmf(char c)
c
- that represents the DTMF to send. '0' ~ '9', 'A' ~ 'D', '*', '#' are valid inputs.public void stopDtmf()
public void sendUssd(String ussdMessage) throws ImsException
ussdMessage
- USSD message to sendImsException
public ImsCall.ImsCallSessionListenerProxy getImsCallSessionListenerProxy()
public boolean isMergeRequestedByConf()
public void resetIsMergeRequestedByConf(boolean value)
public ImsCallSession getSession()
public void conferenceStateUpdated(ImsConferenceState state)
ImsCall
and inform listeners of the
change. Marked as VisibleForTesting
so that the
com.android.internal.telephony.TelephonyTester
class can inject a test conference
event package into a regular ongoing IMS call.state
- The ImsConferenceState
.public void setMergeHost(ImsCall mergeHost)
mergeHost
- The merge host this call will be merged into.public String toString()
ImsCall
. Primarily intended for use in log
statements.public boolean wasVideoCall()
true
if this call was a video call at some point in its life span,
false
otherwise.public boolean isVideoCall()
true
if this call is a video call, false
otherwise.public boolean isWifiCall()
ImsCallProfile.EXTRA_CALL_RAT_TYPE
extra.
This method is primarily intended to be used when checking if answering an incoming audio
call should cause a wifi video call to drop (e.g.
KEY_DROP_VIDEO_CALL_WHEN_ANSWERING_AUDIO_CALL_BOOL
is set).true
if the call is over WIFI, false
otherwise.