public final class InCallAdapter extends Object
InCallService
implementations which should be executed by
Telecom. When Telecom binds to a InCallService
, an instance of this class is given to
the in-call service through which it can manipulate live (active, dialing, ringing) calls. When
the in-call service is notified of new calls, it can use the
given call IDs to execute commands such as answerCall(java.lang.String, int)
for incoming calls or
disconnectCall(java.lang.String)
for active calls the user would like to end. Some commands are only
appropriate for calls in certain states; please consult each method for such limitations.
The adapter will stop functioning when there are no more calls.
Constructor and Description |
---|
InCallAdapter(IInCallAdapter adapter) |
Modifier and Type | Method and Description |
---|---|
void |
answerCall(String callId,
int videoState)
Instructs Telecom to answer the specified call.
|
void |
conference(String callId,
String otherCallId)
Instructs Telecom to conference the specified call.
|
void |
disconnectCall(String callId)
Instructs Telecom to disconnect the specified call.
|
void |
holdCall(String callId)
Instructs Telecom to put the specified call on hold.
|
void |
mergeConference(String callId)
Instructs Telecom to merge child calls of the specified conference call.
|
void |
mute(boolean shouldMute)
Mute the microphone.
|
void |
phoneAccountSelected(String callId,
PhoneAccountHandle accountHandle,
boolean setDefault)
Instructs Telecom to add a PhoneAccountHandle to the specified call.
|
void |
playDtmfTone(String callId,
char digit)
Instructs Telecom to play a dual-tone multi-frequency signaling (DTMF) tone in a call.
|
void |
postDialContinue(String callId,
boolean proceed)
Instructs Telecom to continue playing a post-dial DTMF string.
|
void |
pullExternalCall(String callId)
Instructs Telecom to pull an external call to the local device.
|
void |
putExtra(String callId,
String key,
boolean value)
Intructs Telecom to add an extra to a call.
|
void |
putExtra(String callId,
String key,
int value)
Intructs Telecom to add an extra to a call.
|
void |
putExtra(String callId,
String key,
String value)
Intructs Telecom to add an extra to a call.
|
void |
putExtras(String callId,
Bundle extras)
Intructs Telecom to add extras to a call.
|
void |
rejectCall(String callId,
boolean rejectWithMessage,
String textMessage)
Instructs Telecom to reject the specified call.
|
void |
removeExtras(String callId,
List<String> keys)
Intructs Telecom to remove extras from a call.
|
void |
sendCallEvent(String callId,
String event,
Bundle extras)
Intructs Telecom to send a call event.
|
void |
setAudioRoute(int route)
Sets the audio route (speaker, bluetooth, etc...).
|
void |
splitFromConference(String callId)
Instructs Telecom to split the specified call from any conference call with which it may be
connected.
|
void |
stopDtmfTone(String callId)
Instructs Telecom to stop any dual-tone multi-frequency signaling (DTMF) tone currently
playing.
|
void |
swapConference(String callId)
Instructs Telecom to swap the child calls of the specified conference call.
|
void |
turnProximitySensorOff(boolean screenOnImmediately)
Instructs Telecom to turn the proximity sensor off.
|
void |
turnProximitySensorOn()
Instructs Telecom to turn the proximity sensor on.
|
void |
unholdCall(String callId)
Instructs Telecom to release the specified call from hold.
|
public void answerCall(String callId, int videoState)
callId
- The identifier of the call to answer.videoState
- The video state in which to answer the call.public void rejectCall(String callId, boolean rejectWithMessage, String textMessage)
callId
- The identifier of the call to reject.rejectWithMessage
- Whether to reject with a text message.textMessage
- An optional text message with which to respond.public void disconnectCall(String callId)
callId
- The identifier of the call to disconnect.public void holdCall(String callId)
callId
- The identifier of the call to put on hold.public void unholdCall(String callId)
callId
- The identifier of the call to release from hold.public void mute(boolean shouldMute)
shouldMute
- True if the microphone should be muted.public void setAudioRoute(int route)
CallAudioState
.route
- The audio route to use.public void playDtmfTone(String callId, char digit)
callId
- The unique ID of the call in which the tone will be played.digit
- A character representing the DTMF digit for which to play the tone. This
value must be one of '0'
through '9'
, '*'
or '#'
.public void stopDtmfTone(String callId)
playDtmfTone(String,char)
. If no DTMF tone is
currently playing, this method will do nothing.callId
- The unique ID of the call in which any currently playing tone will be stopped.public void postDialContinue(String callId, boolean proceed)
InCallService
that the call
is in the post dial state.
If the DTMF string contains a TelecomManager.DTMF_CHARACTER_PAUSE
symbol, Telecom
will temporarily pause playing the tones for a pre-defined period of time.
If the DTMF string contains a TelecomManager.DTMF_CHARACTER_WAIT
symbol, Telecom
will pause playing the tones and notify the InCallService
that the call is in the
post dial wait state. When the user decides to continue the postdial sequence, the
InCallService
should invoke the postDialContinue(String,boolean)
method.callId
- The unique ID of the call for which postdial string playing should continue.proceed
- Whether or not to continue with the post-dial sequence.public void phoneAccountSelected(String callId, PhoneAccountHandle accountHandle, boolean setDefault)
callId
- The identifier of the call.accountHandle
- The PhoneAccountHandle through which to place the call.setDefault
- True
if this account should be set as the default for calls.public void conference(String callId, String otherCallId)
callId
- The unique ID of the call.public void splitFromConference(String callId)
callId
- The unique ID of the call.public void mergeConference(String callId)
public void swapConference(String callId)
public void pullExternalCall(String callId)
callId
- The callId to pull.public void sendCallEvent(String callId, String event, Bundle extras)
callId
- The callId to send the event for.event
- The event.extras
- Extras associated with the event.public void putExtras(String callId, Bundle extras)
callId
- The callId to add the extras to.extras
- The extras.public void putExtra(String callId, String key, boolean value)
callId
- The callId to add the extras to.key
- The extra key.value
- The extra value.public void putExtra(String callId, String key, int value)
callId
- The callId to add the extras to.key
- The extra key.value
- The extra value.public void putExtra(String callId, String key, String value)
callId
- The callId to add the extras to.key
- The extra key.value
- The extra value.public void removeExtras(String callId, List<String> keys)
callId
- The callId to remove the extras from.keys
- The extra keys to remove.public void turnProximitySensorOn()
public void turnProximitySensorOff(boolean screenOnImmediately)
screenOnImmediately
- If true, the screen will be turned on immediately if it was
previously off. Otherwise, the screen will only be turned on after the proximity sensor
is no longer triggered.