Connection


public abstract class Connection
extends Conferenceable

java.lang.Object
   ↳ android.telecom.Conferenceable
     ↳ android.telecom.Connection


Represents a phone call or connection to a remote endpoint that carries voice and/or video traffic.

Implementations create a custom subclass of Connection and return it to the framework as the return value of ConnectionService#onCreateIncomingConnection(PhoneAccountHandle, ConnectionRequest) or ConnectionService#onCreateOutgoingConnection(PhoneAccountHandle, ConnectionRequest). Implementations are then responsible for updating the state of the Connection, and must call destroy() to signal to the framework that the Connection is no longer used and associated resources may be recovered.

Subclasses of Connection override the on* methods to provide the ConnectionService's implementation of calling functionality. The on* methods are called by Telecom to inform an instance of a Connection of actions specific to that Connection instance.

Basic call support requires overriding the following methods: onAnswer(), onDisconnect(), onReject(), onAbort()

Where a Connection has CAPABILITY_SUPPORT_HOLD, the onHold() and onUnhold() methods should be overridden to provide hold support for the Connection.

Where a Connection supports a variation of video calling (e.g. the CAPABILITY_SUPPORTS_VT_* capability bits), onAnswer(int) should be overridden to support answering a call as a video call.

Where a Connection has PROPERTY_IS_EXTERNAL_CALL and CAPABILITY_CAN_PULL_CALL, onPullExternalCall() should be overridden to provide support for pulling the external call.

Where a Connection supports conference calling onSeparate() should be overridden.

There are a number of other on* methods which a Connection can choose to implement, depending on whether it is concerned with the associated calls from Telecom. If, for example, call events from a InCallService are handled, onCallEvent(java.lang.String, android.os.Bundle) should be overridden. Another example is onExtrasChanged(android.os.Bundle), which should be overridden if the Connection wishes to make use of extra information provided via the Call#putExtras(Bundle) and Call#removeExtras(String...) methods.

Summary

Nested classes

class Connection.RttModifyStatus

Provides constants to represent the results of responses to session modify requests sent via Call#sendRttRequest() 

class Connection.RttTextStream

Provides methods to read and write RTT data to/from the in-call app. 

class Connection.VideoProvider

Provides a means of controlling the video session associated with a Connection

Constants

int AUDIO_CODEC_AMR

Adaptive Multi-rate audio codec.

int AUDIO_CODEC_AMR_WB

Adaptive Multi-rate wideband audio codec.

int AUDIO_CODEC_EVRC

Enhanced Variable Rate Codec.

int AUDIO_CODEC_EVRC_B

Enhanced Variable Rate Codec B.

int AUDIO_CODEC_EVRC_NW

Enhanced Variable Rate Narrowband-Wideband Codec.

int AUDIO_CODEC_EVRC_WB

Enhanced Variable Rate Wideband Codec.

int AUDIO_CODEC_EVS_FB

Enhanced Voice Services Fullband audio codec.

int AUDIO_CODEC_EVS_NB

Enhanced Voice Services Narrowband audio codec.

int AUDIO_CODEC_EVS_SWB

Enhanced Voice Services Super-Wideband audio codec.

int AUDIO_CODEC_EVS_WB

Enhanced Voice Services Wideband audio codec.

int AUDIO_CODEC_G711A

ITU-T G711A audio codec.

int AUDIO_CODEC_G711AB

ITU-T G711AB audio codec.

int AUDIO_CODEC_G711U

ITU-T G711U audio codec.

int AUDIO_CODEC_G722

ITU-T G722 audio codec.

int AUDIO_CODEC_G723

ITU-T G723 audio codec.

int AUDIO_CODEC_G729

ITU-T G729 audio codec.

int AUDIO_CODEC_GSM_EFR

GSM Enhanced Full-Rate audio codec, also known as GSM-EFR, GSM 06.60, or simply EFR.

int AUDIO_CODEC_GSM_FR

GSM Full-Rate audio codec, also known as GSM-FR, GSM 06.10, GSM, or simply FR.

int AUDIO_CODEC_GSM_HR

GSM Half Rate audio codec.

int AUDIO_CODEC_NONE

Indicates that the audio codec is currently not specified or is unknown.

int AUDIO_CODEC_QCELP13K

Qualcomm code-excited linear prediction 13 kilobit audio codec.

int CAPABILITY_ADD_PARTICIPANT

When set, indicates that this Connection supports initiation of a conference call by directly adding participants using onAddConferenceParticipants(java.util.List).

int CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO

When set, prevents a video call from being downgraded to an audio-only call.

int CAPABILITY_CAN_PAUSE_VIDEO

For video calls, indicates whether the outgoing video for the call can be paused using the VideoProfile.STATE_PAUSED VideoState.

int CAPABILITY_CAN_PULL_CALL

When set for an external connection, indicates that this Connection can be pulled from a remote device to the current device.

int CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION

Indicates that the connection itself wants to handle any sort of reply response, rather than relying on SMS.

int CAPABILITY_CAN_UPGRADE_TO_VIDEO

This constant was deprecated in API level 29. Use CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL and CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL to indicate for a call whether or not video calling is supported.

int CAPABILITY_DISCONNECT_FROM_CONFERENCE

Connection is able to be individually disconnected when in a Conference.

int CAPABILITY_HOLD

Connection can currently be put on hold or unheld.

int CAPABILITY_MANAGE_CONFERENCE

Connection supports conference management.

int CAPABILITY_MERGE_CONFERENCE

Connections within a conference can be merged.

int CAPABILITY_MUTE

Connection can be muted.

int CAPABILITY_REMOTE_PARTY_SUPPORTS_RTT

Indicates whether the remote party supports RTT or not to the UI.

int CAPABILITY_RESPOND_VIA_TEXT

Connection supports responding via text option.

int CAPABILITY_SEPARATE_FROM_CONFERENCE

Connection is able to be separated from its parent Conference, if any.

int CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL

Local device supports bidirectional video calling.

int CAPABILITY_SUPPORTS_VT_LOCAL_RX

Local device supports receiving video.

int CAPABILITY_SUPPORTS_VT_LOCAL_TX

Local device supports transmitting video.

int CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL

Remote device supports bidirectional video calling.

int CAPABILITY_SUPPORTS_VT_REMOTE_RX

Remote device supports receiving video.

int CAPABILITY_SUPPORTS_VT_REMOTE_TX

Remote device supports transmitting video.

int CAPABILITY_SUPPORT_DEFLECT

Call supports the deflect feature.

int CAPABILITY_SUPPORT_HOLD

Connection supports the hold feature.

int CAPABILITY_SWAP_CONFERENCE

Connections within a conference can be swapped between foreground and background.

String EVENT_CALL_HOLD_FAILED

Connection event used to inform Telecom when a hold operation on a call has failed.

String EVENT_CALL_MERGE_FAILED

Connection event used to inform InCallServices when the merging of two calls has failed.

String EVENT_CALL_PULL_FAILED

Connection event used to inform InCallServices when pulling of an external call has failed.

String EVENT_CALL_REMOTELY_HELD

Connection event used to inform InCallServices when a call has been put on hold by the remote party.

String EVENT_CALL_REMOTELY_UNHELD

Connection event used to inform InCallServices when a call which was remotely held (see EVENT_CALL_REMOTELY_HELD) has been un-held by the remote party.

String EVENT_CALL_SWITCH_FAILED

Connection event used to inform Telecom when a switch operation on a call has failed.

String EVENT_MERGE_COMPLETE

Connection event used to inform InCallServices when the process of merging a Connection into a conference has completed.

String EVENT_MERGE_START

Connection event used to inform InCallServices when the process of merging a Connection into a conference has begun.

String EVENT_ON_HOLD_TONE_END

Connection event used to inform Telecom that it should stop the on hold tone.

String EVENT_ON_HOLD_TONE_START

Connection event used to inform Telecom that it should play the on hold tone.

String EVENT_RTT_AUDIO_INDICATION_CHANGED

Connection event used to inform an InCallService that the RTT audio indication has changed.

String EXTRA_ANSWERING_DROPS_FG_CALL

Boolean connection extra key set on a Connection in Connection#STATE_RINGING state to indicate that answering the call will cause the current active foreground call to be dropped.

String EXTRA_ANSWERING_DROPS_FG_CALL_APP_NAME

String connection extra key set on a Connection in Connection#STATE_RINGING state to indicate the name of the third-party app which is responsible for the current foreground call.

String EXTRA_AUDIO_CODEC

The audio codec in use for the current Connection, if known.

String EXTRA_AUDIO_CODEC_BANDWIDTH_KHZ

Float connection extra key used to store the audio codec bandwidth in khz for the current Connection.

String EXTRA_AUDIO_CODEC_BITRATE_KBPS

Float connection extra key used to store the audio codec bitrate in kbps for the current Connection.

String EXTRA_CALL_SUBJECT

Connection extra key used to store the subject for an incoming call.

String EXTRA_CHILD_ADDRESS

Connection extra key used to store a child number associated with the current connection.

String EXTRA_IS_RTT_AUDIO_PRESENT

Boolean connection extra key set on the extras passed to Connection#sendConnectionEvent which indicates that audio is present on the RTT call when the extra value is true.

String EXTRA_LAST_FORWARDED_NUMBER

Connection extra key used to store the last forwarded number associated with the current connection.

String EXTRA_LAST_KNOWN_CELL_IDENTITY

Last known cell identity key CellIdentity to be used to fill geo location header in case of an emergency call.

String EXTRA_SIP_INVITE

String Connection extra key used to store SIP invite fields for an incoming call for IMS call

int PROPERTY_ASSISTED_DIALING

Set by the framework to indicate that a connection is using assisted dialing.

int PROPERTY_CROSS_SIM

Connection is using cross sim technology.

int PROPERTY_HAS_CDMA_VOICE_PRIVACY

Indicates that the connection has CDMA Enhanced Voice Privacy enabled.

int PROPERTY_HIGH_DEF_AUDIO

Connection is using high definition audio.

int PROPERTY_IS_ADHOC_CONFERENCE

Set by the framework to indicate that a call is an adhoc conference call.

int PROPERTY_IS_EXTERNAL_CALL

When set, indicates that the Connection does not actually exist locally for the ConnectionService.

int PROPERTY_IS_RTT

Set by the framework to indicate that a connection has an active RTT session associated with it.

int PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL

Set by the framework to indicate that the network has identified a Connection as an emergency call.

int PROPERTY_SELF_MANAGED

Set by the framework to indicate that the Connection originated from a self-managed ConnectionService.

int PROPERTY_WIFI

Connection is using WIFI.

int STATE_ACTIVE

A connection is active.

int STATE_DIALING

An outgoing connection is in the dialing state.

int STATE_DISCONNECTED

A connection has been disconnected.

int STATE_HOLDING

A connection is on hold.

int STATE_INITIALIZING

The connection is initializing.

int STATE_NEW

The connection is new and not connected.

int STATE_PULLING_CALL

The state of an external connection which is in the process of being pulled from a remote device to the local device.

int STATE_RINGING

An incoming connection is in the ringing state.

int VERIFICATION_STATUS_FAILED

Indicates that verification by the network failed.

int VERIFICATION_STATUS_NOT_VERIFIED

Indicates that the network could not perform verification.

int VERIFICATION_STATUS_PASSED

Indicates that verification by the network passed.

Public constructors

Connection()

Create a new Connection.

Public methods

static String capabilitiesToString(int capabilities)

Renders a set of capability bits (CAPABILITY_*) as a human readable string.

static Connection createCanceledConnection()

Return a Connection which represents a canceled connection attempt.

static Connection createFailedConnection(DisconnectCause disconnectCause)

Return a Connection which represents a failed connection attempt.

final void destroy()

Tears down the Connection object.

final Uri getAddress()
final int getAddressPresentation()
final boolean getAudioModeIsVoip()
final CallAudioState getCallAudioState()

This method was deprecated in API level 34. Use getCurrentCallEndpoint(), onAvailableCallEndpointsChanged(java.util.List) and onMuteStateChanged(boolean) instead.

final String getCallerDisplayName()
final int getCallerDisplayNamePresentation()
final int getCallerNumberVerificationStatus()

Gets the verification status for the phone number of an incoming call as identified in ATIS-1000082.

final Conference getConference()
final List<Conferenceable> getConferenceables()

Returns the connections or conferences with which this connection can be conferenced.

final int getConnectionCapabilities()

Returns the connection's capabilities, as a bit mask of the CAPABILITY_* constants.

final int getConnectionProperties()

Returns the connection's properties, as a bit mask of the PROPERTY_* constants.

final CallEndpoint getCurrentCallEndpoint()

Obtains the current CallEndpoint.

final DisconnectCause getDisconnectCause()
final Bundle getExtras()

Returns the extras associated with this connection.

final int getState()
final StatusHints getStatusHints()
final Connection.VideoProvider getVideoProvider()
final int getVideoState()

Returns the video state of the connection.

void handleRttUpgradeResponse(Connection.RttTextStream rttTextStream)

Notifies this connection of a response to a previous remotely-initiated RTT upgrade request sent via sendRemoteRttRequest().

final boolean isRingbackRequested()

Returns whether this connection is requesting that the system play a ringback tone on its behalf.

final void notifyConferenceMergeFailed()

Called by a ConnectionService to notify Telecom that a Conference#onMerge() request failed.

void onAbort()

Notifies this Connection of a request to abort.

void onAddConferenceParticipants(List<Uri> participants)

Supports initiation of a conference call by directly adding participants to an ongoing call.

void onAnswer(int videoState)

Notifies this Connection, which is in STATE_RINGING, of a request to accept.

void onAnswer()

Notifies this Connection, which is in STATE_RINGING, of a request to accept.

void onAvailableCallEndpointsChanged(List<CallEndpoint> availableEndpoints)

Notifies this Connection that the available call endpoints have been changed.

void onCallAudioStateChanged(CallAudioState state)

This method was deprecated in API level 34. Use onCallEndpointChanged(android.telecom.CallEndpoint), onAvailableCallEndpointsChanged(java.util.List) and onMuteStateChanged(boolean) instead.

void onCallEndpointChanged(CallEndpoint callEndpoint)

Notifies this Connection that the audio endpoint has been changed.

void onCallEvent(String event, Bundle extras)

Notifies this Connection of a Call event initiated from an InCallService.

void onDeflect(Uri address)

Notifies this Connection, which is in STATE_RINGING, of a request to deflect.

void onDisconnect()

Notifies this Connection of a request to disconnect.

void onExtrasChanged(Bundle extras)

Notifies this Connection of a change to the extras made outside the ConnectionService.

void onHandoverComplete()

Notifies this Connection that a handover has completed.

void onHold()

Notifies this Connection of a request to hold.

void onMuteStateChanged(boolean isMuted)

Notifies this Connection that its audio mute state has been changed.

void onPlayDtmfTone(char c)

Notifies this Connection of a request to play a DTMF tone.

void onPostDialContinue(boolean proceed)

Notifies this Connection whether the user wishes to proceed with the post-dial DTMF codes.

void onPullExternalCall()

Notifies this Connection of a request to pull an external call to the local device.

void onReject()

Notifies this Connection, which is in STATE_RINGING, of a request to reject.

void onReject(int rejectReason)

Notifies this Connection, which is in STATE_RINGING, of a request to reject.

void onReject(String replyMessage)

Notifies this Connection, which is in STATE_RINGING, of a request to reject with a message.

void onSeparate()

Notifies this Connection of a request to separate from its parent conference.

void onShowIncomingCallUi()

Notifies this Connection that its ConnectionService is responsible for displaying its incoming call user interface for the Connection.

void onSilence()

Notifies this Connection of a request to silence the ringer.

void onStartRtt(Connection.RttTextStream rttTextStream)

Notifies this Connection that the user has requested an RTT session.

void onStateChanged(int state)

Notifies this Connection of an internal state change.

void onStopDtmfTone()

Notifies this Connection of a request to stop any currently playing DTMF tones.

void onStopRtt()

Notifies this Connection that it should terminate any existing RTT communication channel.

void onTrackedByNonUiService(boolean isTracked)

Inform this Conenection when it will or will not be tracked by an non-UI InCallService.

void onUnhold()

Notifies this Connection of a request to exit a hold state.

void onUsingAlternativeUi(boolean isUsingAlternativeUi)

Inform this Connection when it will or will not be tracked by an InCallService which can provide an InCall UI.

static String propertiesToString(int properties)

Renders a set of property bits (PROPERTY_*) as a human readable string.

final void putExtras(Bundle extras)

Adds some extras to this Connection.

final void queryLocationForEmergency(long timeoutMillis, String provider, Executor executor, OutcomeReceiver<LocationQueryLocationException> callback)

Query the device's location in order to place an Emergency Call.

final void removeExtras(List<String> keys)

Removes extras from this Connection.

final void removeExtras(String... keys)

Removes extras from this Connection.

void requestBluetoothAudio(BluetoothDevice bluetoothDevice)

This method was deprecated in API level 34. Use requestCallEndpointChange(android.telecom.CallEndpoint, java.util.concurrent.Executor, android.os.OutcomeReceiver) instead.

final void requestCallEndpointChange(CallEndpoint endpoint, Executor executor, OutcomeReceiver<VoidCallEndpointException> callback)

Request audio routing to a specific CallEndpoint.

void sendConnectionEvent(String event, Bundle extras)

Sends an event associated with this Connection with associated event extras to the InCallService.

final void sendRemoteRttRequest()

Informs listeners that the remote side of the call has requested an upgrade to include an RTT session in the call.

final void sendRttInitiationFailure(int reason)

Informs listeners that a previously requested RTT session via ConnectionRequest#isRequestingRtt() or onStartRtt(android.telecom.Connection.RttTextStream) has failed.

final void sendRttInitiationSuccess()

Informs listeners that a previously requested RTT session via ConnectionRequest#isRequestingRtt() or onStartRtt(android.telecom.Connection.RttTextStream) has succeeded.

final void sendRttSessionRemotelyTerminated()

Informs listeners that a currently active RTT session has been terminated by the remote side of the coll.

final void setActive()

Sets state to active (e.g., an ongoing connection where two or more parties can actively communicate).

final void setAddress(Uri address, int presentation)

Sets the value of the getAddress() property.

final void setAudioModeIsVoip(boolean isVoip)

Requests that the framework use VOIP audio mode for this connection.

final void setAudioRoute(int route)

This method was deprecated in API level 34. Use requestCallEndpointChange(android.telecom.CallEndpoint, java.util.concurrent.Executor, android.os.OutcomeReceiver) instead.

final void setCallerDisplayName(String callerDisplayName, int presentation)

Sets the caller display name (CNAP).

final void setCallerNumberVerificationStatus(int callerNumberVerificationStatus)

Sets the verification status for the phone number of an incoming call as identified in ATIS-1000082.

final void setConferenceableConnections(List<Connection> conferenceableConnections)

Sets the connections with which this connection can be conferenced.

final void setConferenceables(List<Conferenceable> conferenceables)

Similar to setConferenceableConnections(java.util.List), sets a list of connections or conferences with which this connection can be conferenced.

final void setConnectionCapabilities(int connectionCapabilities)

Sets the connection's capabilities as a bit mask of the CAPABILITY_* constants.

final void setConnectionProperties(int connectionProperties)

Sets the connection's properties as a bit mask of the PROPERTY_* constants.

final void setDialing()

Sets state to dialing (e.g., dialing an outbound connection).

final void setDisconnected(DisconnectCause disconnectCause)

Sets state to disconnected.

final void setExtras(Bundle extras)

Set some extras that can be associated with this Connection.

final void setInitialized()

Sets state to initialized (the Connection has been set up and is now ready to be used).

final void setInitializing()

Sets state to initializing (this Connection is not yet ready to be used).

final void setNextPostDialChar(char nextChar)

Informs listeners that this Connection has processed a character in the post-dial started state.

final void setOnHold()

Sets state to be on hold.

final void setPostDialWait(String remaining)

Informs listeners that this Connection is in a post-dial wait state.

final void setPulling()

Sets state to pulling (e.g. the connection is being pulled to the local device from another device).

final void setRingbackRequested(boolean ringback)

Requests that the framework play a ringback tone.

final void setRinging()

Sets state to ringing (e.g., an inbound ringing connection).

final void setStatusHints(StatusHints statusHints)

Sets the label and icon status to display in the in-call UI.

final void setVideoProvider(Connection.VideoProvider videoProvider)

Sets the video connection provider.

final void setVideoState(int videoState)

Set the video state for the connection.

static String stateToString(int state)

Inherited methods

Constants

AUDIO_CODEC_AMR

Added in API level 30
public static final int AUDIO_CODEC_AMR

Adaptive Multi-rate audio codec.

Constant Value: 1 (0x00000001)

AUDIO_CODEC_AMR_WB

Added in API level 30
public static final int AUDIO_CODEC_AMR_WB

Adaptive Multi-rate wideband audio codec.

Constant Value: 2 (0x00000002)

AUDIO_CODEC_EVRC

Added in API level 30
public static final int AUDIO_CODEC_EVRC

Enhanced Variable Rate Codec. See 3GPP2 C.S0014-A.

Constant Value: 4 (0x00000004)

AUDIO_CODEC_EVRC_B

Added in API level 30
public static final int AUDIO_CODEC_EVRC_B

Enhanced Variable Rate Codec B. Commonly used on CDMA networks.

Constant Value: 5 (0x00000005)

AUDIO_CODEC_EVRC_NW

Added in API level 30
public static final int AUDIO_CODEC_EVRC_NW

Enhanced Variable Rate Narrowband-Wideband Codec.

Constant Value: 7 (0x00000007)

AUDIO_CODEC_EVRC_WB

Added in API level 30
public static final int AUDIO_CODEC_EVRC_WB

Enhanced Variable Rate Wideband Codec. See RFC5188.

Constant Value: 6 (0x00000006)

AUDIO_CODEC_EVS_FB

Added in API level 30
public static final int AUDIO_CODEC_EVS_FB

Enhanced Voice Services Fullband audio codec. See 3GPP TS 26.441.

Constant Value: 20 (0x00000014)

AUDIO_CODEC_EVS_NB

Added in API level 30
public static final int AUDIO_CODEC_EVS_NB

Enhanced Voice Services Narrowband audio codec. See 3GPP TS 26.441.

Constant Value: 17 (0x00000011)

AUDIO_CODEC_EVS_SWB

Added in API level 30
public static final int AUDIO_CODEC_EVS_SWB

Enhanced Voice Services Super-Wideband audio codec. See 3GPP TS 26.441.

Constant Value: 19 (0x00000013)

AUDIO_CODEC_EVS_WB

Added in API level 30
public static final int AUDIO_CODEC_EVS_WB

Enhanced Voice Services Wideband audio codec. See 3GPP TS 26.441.

Constant Value: 18 (0x00000012)

AUDIO_CODEC_G711A

Added in API level 30
public static final int AUDIO_CODEC_G711A

ITU-T G711A audio codec.

Constant Value: 13 (0x0000000d)

AUDIO_CODEC_G711AB

Added in API level 30
public static final int AUDIO_CODEC_G711AB

ITU-T G711AB audio codec.

Constant Value: 15 (0x0000000f)

AUDIO_CODEC_G711U

Added in API level 30
public static final int AUDIO_CODEC_G711U

ITU-T G711U audio codec.

Constant Value: 11 (0x0000000b)

AUDIO_CODEC_G722

Added in API level 30
public static final int AUDIO_CODEC_G722

ITU-T G722 audio codec.

Constant Value: 14 (0x0000000e)

AUDIO_CODEC_G723

Added in API level 30
public static final int AUDIO_CODEC_G723

ITU-T G723 audio codec.

Constant Value: 12 (0x0000000c)

AUDIO_CODEC_G729

Added in API level 30
public static final int AUDIO_CODEC_G729

ITU-T G729 audio codec.

Constant Value: 16 (0x00000010)

AUDIO_CODEC_GSM_EFR

Added in API level 30
public static final int AUDIO_CODEC_GSM_EFR

GSM Enhanced Full-Rate audio codec, also known as GSM-EFR, GSM 06.60, or simply EFR.

Constant Value: 8 (0x00000008)

AUDIO_CODEC_GSM_FR

Added in API level 30
public static final int AUDIO_CODEC_GSM_FR

GSM Full-Rate audio codec, also known as GSM-FR, GSM 06.10, GSM, or simply FR.

Constant Value: 9 (0x00000009)

AUDIO_CODEC_GSM_HR

Added in API level 30
public static final int AUDIO_CODEC_GSM_HR

GSM Half Rate audio codec.

Constant Value: 10 (0x0000000a)

AUDIO_CODEC_NONE

Added in API level 30
public static final int AUDIO_CODEC_NONE

Indicates that the audio codec is currently not specified or is unknown.

Constant Value: 0 (0x00000000)

AUDIO_CODEC_QCELP13K

Added in API level 30
public static final int AUDIO_CODEC_QCELP13K

Qualcomm code-excited linear prediction 13 kilobit audio codec.

Constant Value: 3 (0x00000003)

CAPABILITY_ADD_PARTICIPANT

Added in API level 31
public static final int CAPABILITY_ADD_PARTICIPANT

When set, indicates that this Connection supports initiation of a conference call by directly adding participants using onAddConferenceParticipants(java.util.List). When participants are added to a Connection, it will be replaced by a Conference instance with PROPERTY_IS_ADHOC_CONFERENCE set to indicate that it is an adhoc conference call.

Constant Value: 67108864 (0x04000000)

CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO

Added in API level 24
public static final int CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO

When set, prevents a video call from being downgraded to an audio-only call.

Should be set when the VideoState has the VideoProfile#STATE_TX_ENABLED or VideoProfile#STATE_RX_ENABLED bits set to indicate that the connection cannot be downgraded from a video call back to a VideoState of VideoProfile#STATE_AUDIO_ONLY.

Intuitively, a call which can be downgraded to audio should also have local and remote video capabilities (see CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL and CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL).

Constant Value: 8388608 (0x00800000)

CAPABILITY_CAN_PAUSE_VIDEO

Added in API level 23
public static final int CAPABILITY_CAN_PAUSE_VIDEO

For video calls, indicates whether the outgoing video for the call can be paused using the VideoProfile.STATE_PAUSED VideoState.

Constant Value: 1048576 (0x00100000)

CAPABILITY_CAN_PULL_CALL

Added in API level 25
public static final int CAPABILITY_CAN_PULL_CALL

When set for an external connection, indicates that this Connection can be pulled from a remote device to the current device.

Should only be set on a Connection where PROPERTY_IS_EXTERNAL_CALL is set.

Constant Value: 16777216 (0x01000000)

CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION

Added in API level 24
public static final int CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION

Indicates that the connection itself wants to handle any sort of reply response, rather than relying on SMS.

Constant Value: 4194304 (0x00400000)

CAPABILITY_CAN_UPGRADE_TO_VIDEO

Added in API level 23
Deprecated in API level 29
public static final int CAPABILITY_CAN_UPGRADE_TO_VIDEO

This constant was deprecated in API level 29.
Use CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL and CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL to indicate for a call whether or not video calling is supported.

Call can be upgraded to a video call.

Constant Value: 524288 (0x00080000)

CAPABILITY_DISCONNECT_FROM_CONFERENCE

Added in API level 23
public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE

Connection is able to be individually disconnected when in a Conference.

Constant Value: 8192 (0x00002000)

CAPABILITY_HOLD

Added in API level 23
public static final int CAPABILITY_HOLD

Connection can currently be put on hold or unheld. This is distinct from CAPABILITY_SUPPORT_HOLD in that although a connection may support 'hold' most times, it does not at the moment support the function. This can be true while the call is in the state STATE_DIALING, for example. During this condition, an in-call UI may display a disabled 'hold' button.

Constant Value: 1 (0x00000001)

CAPABILITY_MANAGE_CONFERENCE

Added in API level 23
public static final int CAPABILITY_MANAGE_CONFERENCE

Connection supports conference management. This capability only applies to Conferences which can have Connections as children.

Constant Value: 128 (0x00000080)

CAPABILITY_MERGE_CONFERENCE

Added in API level 23
public static final int CAPABILITY_MERGE_CONFERENCE

Connections within a conference can be merged. A ConnectionService has the option to add a Conference before the child Connections are merged. This is how CDMA-based Connections are implemented. For these unmerged Conferences, this capability allows a merge button to be shown while the conference is in the foreground of the in-call UI.

This is only intended for use by a Conference.

Constant Value: 4 (0x00000004)

CAPABILITY_MUTE

Added in API level 23
public static final int CAPABILITY_MUTE

Connection can be muted.

Constant Value: 64 (0x00000040)

CAPABILITY_REMOTE_PARTY_SUPPORTS_RTT

Added in API level 33
public static final int CAPABILITY_REMOTE_PARTY_SUPPORTS_RTT

Indicates whether the remote party supports RTT or not to the UI.

Constant Value: 536870912 (0x20000000)

CAPABILITY_RESPOND_VIA_TEXT

Added in API level 23
public static final int CAPABILITY_RESPOND_VIA_TEXT

Connection supports responding via text option.

Constant Value: 32 (0x00000020)

CAPABILITY_SEPARATE_FROM_CONFERENCE

Added in API level 23
public static final int CAPABILITY_SEPARATE_FROM_CONFERENCE

Connection is able to be separated from its parent Conference, if any.

Constant Value: 4096 (0x00001000)

CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL

Added in API level 23
public static final int CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL

Local device supports bidirectional video calling.

Constant Value: 768 (0x00000300)

CAPABILITY_SUPPORTS_VT_LOCAL_RX

Added in API level 23
public static final int CAPABILITY_SUPPORTS_VT_LOCAL_RX

Local device supports receiving video.

Constant Value: 256 (0x00000100)

CAPABILITY_SUPPORTS_VT_LOCAL_TX

Added in API level 23
public static final int CAPABILITY_SUPPORTS_VT_LOCAL_TX

Local device supports transmitting video.

Constant Value: 512 (0x00000200)

CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL

Added in API level 23
public static final int CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL

Remote device supports bidirectional video calling.

Constant Value: 3072 (0x00000c00)

CAPABILITY_SUPPORTS_VT_REMOTE_RX

Added in API level 23
public static final int CAPABILITY_SUPPORTS_VT_REMOTE_RX

Remote device supports receiving video.

Constant Value: 1024 (0x00000400)

CAPABILITY_SUPPORTS_VT_REMOTE_TX

Added in API level 23
public static final int CAPABILITY_SUPPORTS_VT_REMOTE_TX

Remote device supports transmitting video.

Constant Value: 2048 (0x00000800)

CAPABILITY_SUPPORT_DEFLECT

Added in API level 28
public static final int CAPABILITY_SUPPORT_DEFLECT

Call supports the deflect feature.

Constant Value: 33554432 (0x02000000)

CAPABILITY_SUPPORT_HOLD

Added in API level 23
public static final int CAPABILITY_SUPPORT_HOLD

Connection supports the hold feature.

Constant Value: 2 (0x00000002)

CAPABILITY_SWAP_CONFERENCE

Added in API level 23
public static final int CAPABILITY_SWAP_CONFERENCE

Connections within a conference can be swapped between foreground and background. See CAPABILITY_MERGE_CONFERENCE for additional information.

This is only intended for use by a Conference.

Constant Value: 8 (0x00000008)

EVENT_CALL_HOLD_FAILED

Added in API level 30
public static final String EVENT_CALL_HOLD_FAILED

Connection event used to inform Telecom when a hold operation on a call has failed.

Sent via sendConnectionEvent(java.lang.String, android.os.Bundle). The Bundle parameter is expected to be null when this connection event is used.

Constant Value: "android.telecom.event.CALL_HOLD_FAILED"

EVENT_CALL_MERGE_FAILED

Added in API level 25
public static final String EVENT_CALL_MERGE_FAILED

Connection event used to inform InCallServices when the merging of two calls has failed. The User Interface should use this message to inform the user of the error.

Sent via sendConnectionEvent(java.lang.String, android.os.Bundle). The Bundle parameter is expected to be null when this connection event is used.

Constant Value: "android.telecom.event.CALL_MERGE_FAILED"

EVENT_CALL_PULL_FAILED

Added in API level 25
public static final String EVENT_CALL_PULL_FAILED

Connection event used to inform InCallServices when pulling of an external call has failed. The user interface should inform the user of the error.

Expected to be used by the ConnectionService when the Call#pullExternalCall() API is called on a Call with the properties Call.Details#PROPERTY_IS_EXTERNAL_CALL and Call.Details#CAPABILITY_CAN_PULL_CALL, but the ConnectionService could not pull the external call due to an error condition.

Sent via sendConnectionEvent(java.lang.String, android.os.Bundle). The Bundle parameter is expected to be null when this connection event is used.

Constant Value: "android.telecom.event.CALL_PULL_FAILED"

EVENT_CALL_REMOTELY_HELD

Added in API level 30
public static final String EVENT_CALL_REMOTELY_HELD

Connection event used to inform InCallServices when a call has been put on hold by the remote party.

This is different than the Connection#STATE_HOLDING state which indicates that the call is being held locally on the device. When a capable ConnectionService receives signalling to indicate that the remote party has put the call on hold, it can send this connection event.

Constant Value: "android.telecom.event.CALL_REMOTELY_HELD"

EVENT_CALL_REMOTELY_UNHELD

Added in API level 30
public static final String EVENT_CALL_REMOTELY_UNHELD

Connection event used to inform InCallServices when a call which was remotely held (see EVENT_CALL_REMOTELY_HELD) has been un-held by the remote party.

This is different than the Connection#STATE_HOLDING state which indicates that the call is being held locally on the device. When a capable ConnectionService receives signalling to indicate that the remote party has taken the call off hold, it can send this connection event.

Constant Value: "android.telecom.event.CALL_REMOTELY_UNHELD"

EVENT_CALL_SWITCH_FAILED

Added in API level 30
public static final String EVENT_CALL_SWITCH_FAILED

Connection event used to inform Telecom when a switch operation on a call has failed.

Sent via sendConnectionEvent(java.lang.String, android.os.Bundle). The Bundle parameter is expected to be null when this connection event is used.

Constant Value: "android.telecom.event.CALL_SWITCH_FAILED"

EVENT_MERGE_COMPLETE

Added in API level 30
public static final String EVENT_MERGE_COMPLETE

Connection event used to inform InCallServices when the process of merging a Connection into a conference has completed.

Sent via sendConnectionEvent(java.lang.String, android.os.Bundle). The Bundle parameter is expected to be null when this connection event is used.

Constant Value: "android.telecom.event.MERGE_COMPLETE"

EVENT_MERGE_START

Added in API level 30
public static final String EVENT_MERGE_START

Connection event used to inform InCallServices when the process of merging a Connection into a conference has begun.

Sent via sendConnectionEvent(java.lang.String, android.os.Bundle). The Bundle parameter is expected to be null when this connection event is used.

Constant Value: "android.telecom.event.MERGE_START"

EVENT_ON_HOLD_TONE_END

Added in API level 30
public static final String EVENT_ON_HOLD_TONE_END

Connection event used to inform Telecom that it should stop the on hold tone. This is used to stop a tone when the peer puts the current call on hold. Sent to Telecom via sendConnectionEvent(java.lang.String, android.os.Bundle).

Constant Value: "android.telecom.event.ON_HOLD_TONE_END"

EVENT_ON_HOLD_TONE_START

Added in API level 30
public static final String EVENT_ON_HOLD_TONE_START

Connection event used to inform Telecom that it should play the on hold tone. This is used to play a tone when the peer puts the current call on hold. Sent to Telecom via sendConnectionEvent(java.lang.String, android.os.Bundle).

Constant Value: "android.telecom.event.ON_HOLD_TONE_START"

EVENT_RTT_AUDIO_INDICATION_CHANGED

Added in API level 29
public static final String EVENT_RTT_AUDIO_INDICATION_CHANGED

Connection event used to inform an InCallService that the RTT audio indication has changed.

Constant Value: "android.telecom.event.RTT_AUDIO_INDICATION_CHANGED"

EXTRA_ANSWERING_DROPS_FG_CALL

Added in API level 25
public static final String EXTRA_ANSWERING_DROPS_FG_CALL

Boolean connection extra key set on a Connection in Connection#STATE_RINGING state to indicate that answering the call will cause the current active foreground call to be dropped.

Constant Value: "android.telecom.extra.ANSWERING_DROPS_FG_CALL"

EXTRA_ANSWERING_DROPS_FG_CALL_APP_NAME

Added in API level 26
public static final String EXTRA_ANSWERING_DROPS_FG_CALL_APP_NAME

String connection extra key set on a Connection in Connection#STATE_RINGING state to indicate the name of the third-party app which is responsible for the current foreground call.

Used when EXTRA_ANSWERING_DROPS_FG_CALL is true to ensure that the default Phone app is able to inform the user that answering the new incoming call will cause a call owned by another app to be dropped when the incoming call is answered.

Constant Value: "android.telecom.extra.ANSWERING_DROPS_FG_CALL_APP_NAME"

EXTRA_AUDIO_CODEC_BANDWIDTH_KHZ

Added in API level 31
public static final String EXTRA_AUDIO_CODEC_BANDWIDTH_KHZ

Float connection extra key used to store the audio codec bandwidth in khz for the current Connection.

Constant Value: "android.telecom.extra.AUDIO_CODEC_BANDWIDTH_KHZ"

EXTRA_AUDIO_CODEC_BITRATE_KBPS

Added in API level 31
public static final String EXTRA_AUDIO_CODEC_BITRATE_KBPS

Float connection extra key used to store the audio codec bitrate in kbps for the current Connection.

Constant Value: "android.telecom.extra.AUDIO_CODEC_BITRATE_KBPS"

EXTRA_CALL_SUBJECT

Added in API level 23
public static final String EXTRA_CALL_SUBJECT

Connection extra key used to store the subject for an incoming call. The user interface can query this extra and display its contents for incoming calls. Will only be used if the PhoneAccount supports the capability PhoneAccount#CAPABILITY_CALL_SUBJECT.

Constant Value: "android.telecom.extra.CALL_SUBJECT"

EXTRA_CHILD_ADDRESS

Added in API level 23
public static final String EXTRA_CHILD_ADDRESS

Connection extra key used to store a child number associated with the current connection. Used to communicate to the user interface that the connection was received via a child address (i.e. phone number) associated with the PhoneAccount's primary address.

Constant Value: "android.telecom.extra.CHILD_ADDRESS"

EXTRA_IS_RTT_AUDIO_PRESENT

Added in API level 29
public static final String EXTRA_IS_RTT_AUDIO_PRESENT

Boolean connection extra key set on the extras passed to Connection#sendConnectionEvent which indicates that audio is present on the RTT call when the extra value is true.

Constant Value: "android.telecom.extra.IS_RTT_AUDIO_PRESENT"

EXTRA_LAST_FORWARDED_NUMBER

Added in API level 23
public static final String EXTRA_LAST_FORWARDED_NUMBER

Connection extra key used to store the last forwarded number associated with the current connection. Used to communicate to the user interface that the connection was forwarded via the specified number.

Constant Value: "android.telecom.extra.LAST_FORWARDED_NUMBER"

EXTRA_LAST_KNOWN_CELL_IDENTITY

Added in API level 33
public static final String EXTRA_LAST_KNOWN_CELL_IDENTITY

Last known cell identity key CellIdentity to be used to fill geo location header in case of an emergency call. This entry will not be filled if call is not identified as an emergency call. Only provided to the ConnectionService for the purpose of placing an emergency call; will not be present in the InCallService layer. The ConnectionService's implementation will be logged for fine location access when an outgoing call is placed in this case.

Constant Value: "android.telecom.extra.LAST_KNOWN_CELL_IDENTITY"

EXTRA_SIP_INVITE

Added in API level 29
public static final String EXTRA_SIP_INVITE

String Connection extra key used to store SIP invite fields for an incoming call for IMS call

Constant Value: "android.telecom.extra.SIP_INVITE"

PROPERTY_ASSISTED_DIALING

Added in API level 30
public static final int PROPERTY_ASSISTED_DIALING

Set by the framework to indicate that a connection is using assisted dialing.

This is used for outgoing calls.

Constant Value: 512 (0x00000200)

PROPERTY_CROSS_SIM

Added in API level 31
public static final int PROPERTY_CROSS_SIM

Connection is using cross sim technology.

Indicates that the Connection is using a cross sim technology which would register IMS over internet APN of default data subscription.

Constant Value: 8192 (0x00002000)

PROPERTY_HAS_CDMA_VOICE_PRIVACY

Added in API level 25
public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY

Indicates that the connection has CDMA Enhanced Voice Privacy enabled.

Constant Value: 32 (0x00000020)

PROPERTY_HIGH_DEF_AUDIO

Added in API level 30
public static final int PROPERTY_HIGH_DEF_AUDIO

Connection is using high definition audio.

Indicates that the Connection is using a "high definition" audio codec. This usually implies something like AMR wideband, but the interpretation of when a call is considered high definition is left to the ConnectionService to decide.

Translates to Call.Details.PROPERTY_HIGH_DEF_AUDIO.

Constant Value: 4 (0x00000004)

PROPERTY_IS_ADHOC_CONFERENCE

Added in API level 31
public static final int PROPERTY_IS_ADHOC_CONFERENCE

Set by the framework to indicate that a call is an adhoc conference call.

This is used for outgoing and incoming conference calls.

Constant Value: 4096 (0x00001000)

PROPERTY_IS_EXTERNAL_CALL

Added in API level 25
public static final int PROPERTY_IS_EXTERNAL_CALL

When set, indicates that the Connection does not actually exist locally for the ConnectionService.

Consider, for example, a scenario where a user has two devices with the same phone number. When a user places a call on one devices, the telephony stack can represent that call on the other device by adding is to the ConnectionService with the PROPERTY_IS_EXTERNAL_CALL capability set.

An ConnectionService should not assume that all InCallServices will handle external connections. Only those InCallServices which have the TelecomManager#METADATA_INCLUDE_EXTERNAL_CALLS metadata set to true in its manifest will see external connections.

Constant Value: 16 (0x00000010)

PROPERTY_IS_RTT

Added in API level 28
public static final int PROPERTY_IS_RTT

Set by the framework to indicate that a connection has an active RTT session associated with it.

Constant Value: 256 (0x00000100)

PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL

Added in API level 30
public static final int PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL

Set by the framework to indicate that the network has identified a Connection as an emergency call.

This is used for incoming (mobile-terminated) calls to indicate the call is from emergency services.

Constant Value: 1024 (0x00000400)

PROPERTY_SELF_MANAGED

Added in API level 26
public static final int PROPERTY_SELF_MANAGED

Set by the framework to indicate that the Connection originated from a self-managed ConnectionService.

See PhoneAccount#CAPABILITY_SELF_MANAGED.

Constant Value: 128 (0x00000080)

PROPERTY_WIFI

Added in API level 30
public static final int PROPERTY_WIFI

Connection is using WIFI.

Used to indicate that a call is taking place over WIFI versus a carrier network.

Translates to Call.Details.PROPERTY_WIFI.

Constant Value: 8 (0x00000008)

STATE_ACTIVE

Added in API level 23
public static final int STATE_ACTIVE

A connection is active. Both parties are connected to the call and can actively communicate.

Constant Value: 4 (0x00000004)

STATE_DIALING

Added in API level 23
public static final int STATE_DIALING

An outgoing connection is in the dialing state. In this state the other party has not yet answered the call and the user traditionally hears a ringback tone.

Constant Value: 3 (0x00000003)

STATE_DISCONNECTED

Added in API level 23
public static final int STATE_DISCONNECTED

A connection has been disconnected. This is the final state once the user has been disconnected from a call either locally, remotely or by an error in the service.

Constant Value: 6 (0x00000006)

STATE_HOLDING

Added in API level 23
public static final int STATE_HOLDING

A connection is on hold.

Constant Value: 5 (0x00000005)

STATE_INITIALIZING

Added in API level 23
public static final int STATE_INITIALIZING

The connection is initializing. This is generally the first state for a Connection returned by a ConnectionService.

Constant Value: 0 (0x00000000)

STATE_NEW

Added in API level 23
public static final int STATE_NEW

The connection is new and not connected.

Constant Value: 1 (0x00000001)

STATE_PULLING_CALL

Added in API level 25
public static final int STATE_PULLING_CALL

The state of an external connection which is in the process of being pulled from a remote device to the local device.

A connection can only be in this state if the PROPERTY_IS_EXTERNAL_CALL property and CAPABILITY_CAN_PULL_CALL capability bits are set on the connection.

Constant Value: 7 (0x00000007)

STATE_RINGING

Added in API level 23
public static final int STATE_RINGING

An incoming connection is in the ringing state. During this state, the user's ringer or vibration feature will be activated.

Constant Value: 2 (0x00000002)

VERIFICATION_STATUS_FAILED

Added in API level 30
public static final int VERIFICATION_STATUS_FAILED

Indicates that verification by the network failed. This indicates there is a high likelihood that the call did not originate from a valid source.

Constant Value: 2 (0x00000002)

VERIFICATION_STATUS_NOT_VERIFIED

Added in API level 30
public static final int VERIFICATION_STATUS_NOT_VERIFIED

Indicates that the network could not perform verification.

Constant Value: 0 (0x00000000)

VERIFICATION_STATUS_PASSED

Added in API level 30
public static final int VERIFICATION_STATUS_PASSED

Indicates that verification by the network passed. This indicates there is a high likelihood that the call originated from a valid source.

Constant Value: 1 (0x00000001)

Public constructors

Connection

Added in API level 23
public Connection ()

Create a new Connection.

Public methods

capabilitiesToString

Added in API level 23
public static String capabilitiesToString (int capabilities)

Renders a set of capability bits (CAPABILITY_*) as a human readable string.

Parameters
capabilities int: A capability bit field.

Returns
String A human readable string representation.

createCanceledConnection

Added in API level 23
public static Connection createCanceledConnection ()

Return a Connection which represents a canceled connection attempt. The returned Connection will have state STATE_DISCONNECTED, and cannot be moved out of that state. This connection should not be used for anything, and no other Connections should be attempted.

so users of this method need not maintain a reference to its return value to destroy it.

Returns
Connection A Connection which indicates that the underlying connection should be canceled.

createFailedConnection

Added in API level 23
public static Connection createFailedConnection (DisconnectCause disconnectCause)

Return a Connection which represents a failed connection attempt. The returned Connection will have a DisconnectCause and as specified, and a getState() of STATE_DISCONNECTED.

The returned Connection can be assumed to destroy() itself when appropriate, so users of this method need not maintain a reference to its return value to destroy it.

Parameters
disconnectCause DisconnectCause: The disconnect cause, ().

Returns
Connection A Connection which indicates failure.

destroy

Added in API level 23
public final void destroy ()

Tears down the Connection object.

getAddress

Added in API level 23
public final Uri getAddress ()

Returns
Uri The address (e.g., phone number) to which this Connection is currently communicating.

getAddressPresentation

Added in API level 23
public final int getAddressPresentation ()

Returns
int The presentation requirements for the address. See TelecomManager for valid values.

getAudioModeIsVoip

Added in API level 23
public final boolean getAudioModeIsVoip ()

Returns
boolean True if the connection's audio mode is VOIP.

getCallAudioState

Added in API level 23
Deprecated in API level 34
public final CallAudioState getCallAudioState ()

This method was deprecated in API level 34.
Use getCurrentCallEndpoint(), onAvailableCallEndpointsChanged(java.util.List) and onMuteStateChanged(boolean) instead.

Returns
CallAudioState The audio state of the connection, describing how its audio is currently being routed by the system. This is null if this Connection does not directly know about its audio state.

getCallerDisplayName

Added in API level 23
public final String getCallerDisplayName ()

Returns
String The caller display name (CNAP).

getCallerDisplayNamePresentation

Added in API level 23
public final int getCallerDisplayNamePresentation ()

Returns
int The presentation requirements for the handle. See TelecomManager for valid values.

getCallerNumberVerificationStatus

Added in API level 30
public final int getCallerNumberVerificationStatus ()

Gets the verification status for the phone number of an incoming call as identified in ATIS-1000082.

Returns
int the verification status. Value is VERIFICATION_STATUS_NOT_VERIFIED, VERIFICATION_STATUS_PASSED, or VERIFICATION_STATUS_FAILED

getConference

Added in API level 23
public final Conference getConference ()

Returns
Conference The conference that this connection is a part of. Null if it is not part of any conference.

getConferenceables

Added in API level 23
public final List<Conferenceable> getConferenceables ()

Returns the connections or conferences with which this connection can be conferenced.

Returns
List<Conferenceable>

getConnectionCapabilities

Added in API level 23
public final int getConnectionCapabilities ()

Returns the connection's capabilities, as a bit mask of the CAPABILITY_* constants.

Returns
int

getConnectionProperties

Added in API level 25
public final int getConnectionProperties ()

Returns the connection's properties, as a bit mask of the PROPERTY_* constants.

Returns
int

getCurrentCallEndpoint

Added in API level 34
public final CallEndpoint getCurrentCallEndpoint ()

Obtains the current CallEndpoint.

Returns
CallEndpoint An object encapsulating the CallEndpoint. This value cannot be null.

getDisconnectCause

Added in API level 23
public final DisconnectCause getDisconnectCause ()

Returns
DisconnectCause The DisconnectCause for this connection.

getExtras

Added in API level 23
public final Bundle getExtras ()

Returns the extras associated with this connection.

Extras should be updated using putExtras(android.os.Bundle).

Telecom or an InCallService can also update the extras via Call.putExtras(Bundle), and Call#removeExtras(List).

The connection is notified of changes to the extras made by Telecom or an InCallService by onExtrasChanged(android.os.Bundle).

Returns
Bundle The extras associated with this connection.

getState

Added in API level 23
public final int getState ()

Returns
int The state of this Connection.

getStatusHints

Added in API level 23
public final StatusHints getStatusHints ()

Returns
StatusHints The status hints for this connection.

getVideoProvider

Added in API level 23
public final Connection.VideoProvider getVideoProvider ()

Returns
Connection.VideoProvider

getVideoState

Added in API level 30
public final int getVideoState ()

Returns the video state of the connection. Valid values: VideoProfile#STATE_AUDIO_ONLY, VideoProfile#STATE_BIDIRECTIONAL, VideoProfile#STATE_TX_ENABLED, VideoProfile#STATE_RX_ENABLED.

Returns
int The video state of the connection. Value is either 0 or a combination of VideoProfile.STATE_AUDIO_ONLY, VideoProfile.STATE_TX_ENABLED, VideoProfile.STATE_RX_ENABLED, VideoProfile.STATE_BIDIRECTIONAL, and VideoProfile.STATE_PAUSED

handleRttUpgradeResponse

Added in API level 28
public void handleRttUpgradeResponse (Connection.RttTextStream rttTextStream)

Notifies this connection of a response to a previous remotely-initiated RTT upgrade request sent via sendRemoteRttRequest(). Acceptance of the request is indicated by the supplied RttTextStream being non-null, and rejection is indicated by rttTextStream being null

Parameters
rttTextStream Connection.RttTextStream: The object that should be used to send text to or receive text from the in-call app. This value may be null.

isRingbackRequested

Added in API level 23
public final boolean isRingbackRequested ()

Returns whether this connection is requesting that the system play a ringback tone on its behalf.

Returns
boolean

notifyConferenceMergeFailed

Added in API level 30
public final void notifyConferenceMergeFailed ()

Called by a ConnectionService to notify Telecom that a Conference#onMerge() request failed.

onAbort

Added in API level 23
public void onAbort ()

Notifies this Connection of a request to abort.

onAddConferenceParticipants

Added in API level 31
public void onAddConferenceParticipants (List<Uri> participants)

Supports initiation of a conference call by directly adding participants to an ongoing call.

Parameters
participants List: with which conference call will be formed. This value cannot be null.

onAnswer

Added in API level 23
public void onAnswer (int videoState)

Notifies this Connection, which is in STATE_RINGING, of a request to accept.

For managed ConnectionServices, this will be called when the user answers a call via the default dialer's InCallService.

Although a self-managed ConnectionService provides its own incoming call UI, the Telecom framework may request that the call is answered in the following circumstances:

Parameters
videoState int: The video state in which to answer the connection.

onAnswer

Added in API level 23
public void onAnswer ()

Notifies this Connection, which is in STATE_RINGING, of a request to accept.

For managed ConnectionServices, this will be called when the user answers a call via the default dialer's InCallService.

Although a self-managed ConnectionService provides its own incoming call UI, the Telecom framework may request that the call is answered in the following circumstances:

onAvailableCallEndpointsChanged

Added in API level 34
public void onAvailableCallEndpointsChanged (List<CallEndpoint> availableEndpoints)

Notifies this Connection that the available call endpoints have been changed.

Parameters
availableEndpoints List: The set of available CallEndpoint. This value cannot be null.

onCallAudioStateChanged

Added in API level 23
Deprecated in API level 34
public void onCallAudioStateChanged (CallAudioState state)

This method was deprecated in API level 34.
Use onCallEndpointChanged(android.telecom.CallEndpoint), onAvailableCallEndpointsChanged(java.util.List) and onMuteStateChanged(boolean) instead.

Notifies this Connection that the getCallAudioState() property has a new value.

Parameters
state CallAudioState: The new connection audio state.

onCallEndpointChanged

Added in API level 34
public void onCallEndpointChanged (CallEndpoint callEndpoint)

Notifies this Connection that the audio endpoint has been changed.

Parameters
callEndpoint CallEndpoint: The current CallEndpoint. This value cannot be null.

onCallEvent

Added in API level 25
public void onCallEvent (String event, 
                Bundle extras)

Notifies this Connection of a Call event initiated from an InCallService.

The InCallService issues a Call event via Call#sendCallEvent(String, Bundle).

Where possible, the Connection should make an attempt to handle Call events which are part of the android.telecom.* namespace. The Connection should ignore any events it does not wish to handle. Unexpected events should be handled gracefully, as it is possible that a InCallService has defined its own Call events which a Connection is not aware of.

See also Call#sendCallEvent(String, Bundle).

Parameters
event String: The call event.

extras Bundle: Extras associated with the call event.

onDeflect

Added in API level 28
public void onDeflect (Uri address)

Notifies this Connection, which is in STATE_RINGING, of a request to deflect.

Parameters
address Uri

onDisconnect

Added in API level 23
public void onDisconnect ()

Notifies this Connection of a request to disconnect.

onExtrasChanged

Added in API level 25
public void onExtrasChanged (Bundle extras)

Notifies this Connection of a change to the extras made outside the ConnectionService.

These extras changes can originate from Telecom itself, or from an InCallService via the Call.putExtras(Bundle) and Call#removeExtras(List).

Parameters
extras Bundle: The new extras bundle.

onHandoverComplete

Added in API level 28
public void onHandoverComplete ()

Notifies this Connection that a handover has completed.

A handover is initiated with Call.handoverTo(PhoneAccountHandle, int, Bundle) on the initiating side of the handover, and TelecomManager#acceptHandover(Uri, int, PhoneAccountHandle).

onHold

Added in API level 23
public void onHold ()

Notifies this Connection of a request to hold. Connection#setOnHold should be within the onHold() body in order to transition the call state to Connection#STATE_HOLDING.

Note: If the Connection does not transition to Connection#STATE_HOLDING within 2 seconds, the call will be disconnected.

onMuteStateChanged

Added in API level 34
public void onMuteStateChanged (boolean isMuted)

Notifies this Connection that its audio mute state has been changed.

Parameters
isMuted boolean: The current mute state.

onPlayDtmfTone

Added in API level 23
public void onPlayDtmfTone (char c)

Notifies this Connection of a request to play a DTMF tone.

Parameters
c char: A DTMF character.

onPostDialContinue

Added in API level 23
public void onPostDialContinue (boolean proceed)

Notifies this Connection whether the user wishes to proceed with the post-dial DTMF codes.

Parameters
proceed boolean

onPullExternalCall

Added in API level 25
public void onPullExternalCall ()

Notifies this Connection of a request to pull an external call to the local device.

The InCallService issues a request to pull an external call to the local device via Call#pullExternalCall().

For a Connection to be pulled, both the Connection#CAPABILITY_CAN_PULL_CALL capability and Connection#PROPERTY_IS_EXTERNAL_CALL property bits must be set.

For more information on external calls, see Connection#PROPERTY_IS_EXTERNAL_CALL.

onReject

Added in API level 23
public void onReject ()

Notifies this Connection, which is in STATE_RINGING, of a request to reject.

For managed ConnectionServices, this will be called when the user rejects a call via the default dialer's InCallService.

Although a self-managed ConnectionService provides its own incoming call UI, the Telecom framework may request that the call is rejected in the following circumstances:

onReject

Added in API level 30
public void onReject (int rejectReason)

Notifies this Connection, which is in STATE_RINGING, of a request to reject.

For managed ConnectionServices, this will be called when the user rejects a call via the default dialer's InCallService using Call#reject(int).

Parameters
rejectReason int: the reason the user provided for rejecting the call. Value is Call.REJECT_REASON_DECLINED, or Call.REJECT_REASON_UNWANTED

onReject

Added in API level 24
public void onReject (String replyMessage)

Notifies this Connection, which is in STATE_RINGING, of a request to reject with a message.

Parameters
replyMessage String

onSeparate

Added in API level 23
public void onSeparate ()

Notifies this Connection of a request to separate from its parent conference.

onShowIncomingCallUi

Added in API level 26
public void onShowIncomingCallUi ()

Notifies this Connection that its ConnectionService is responsible for displaying its incoming call user interface for the Connection.

Will only be called for incoming calls added via a self-managed ConnectionService (see PhoneAccount#CAPABILITY_SELF_MANAGED), where the ConnectionService should show its own incoming call user interface.

Where there are ongoing calls in other self-managed ConnectionServices, or in a regular ConnectionService, and it is not possible to hold these other calls, the Telecom framework will display its own incoming call user interface to allow the user to choose whether to answer the new incoming call and disconnect other ongoing calls, or to reject the new incoming call.

You should trigger the display of the incoming call user interface for your application by showing a Notification with a full-screen Intent specified. In your application code, you should create a NotificationChannel for incoming call notifications from your app:


 NotificationChannel channel = new NotificationChannel(YOUR_CHANNEL_ID, "Incoming Calls",
          NotificationManager.IMPORTANCE_MAX);
 // other channel setup stuff goes here.

 // We'll use the default system ringtone for our incoming call notification channel.  You can
 // use your own audio resource here.
 Uri ringtoneUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
 channel.setSound(ringtoneUri, new AudioAttributes.Builder()
          // Setting the AudioAttributes is important as it identifies the purpose of your
          // notification sound.
          .setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE)
          .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
      .build());

 NotificationManager mgr = getSystemService(NotificationManager.class);
 mgr.createNotificationChannel(channel);
 
When it comes time to post a notification for your incoming call, ensure it uses your incoming call NotificationChannel.

     // Create an intent which triggers your fullscreen incoming call user interface.
     Intent intent = new Intent(Intent.ACTION_MAIN, null);
     intent.setFlags(Intent.FLAG_ACTIVITY_NO_USER_ACTION | Intent.FLAG_ACTIVITY_NEW_TASK);
     intent.setClass(context, YourIncomingCallActivity.class);
     PendingIntent pendingIntent = PendingIntent.getActivity(context, 1, intent, PendingIntent.FLAG_MUTABLE_UNAUDITED);

     // Build the notification as an ongoing high priority item; this ensures it will show as
     // a heads up notification which slides down over top of the current content.
     final Notification.Builder builder = new Notification.Builder(context);
     builder.setOngoing(true);
     builder.setPriority(Notification.PRIORITY_HIGH);

     // Set notification content intent to take user to fullscreen UI if user taps on the
     // notification body.
     builder.setContentIntent(pendingIntent);
     // Set full screen intent to trigger display of the fullscreen UI when the notification
     // manager deems it appropriate.
     builder.setFullScreenIntent(pendingIntent, true);

     // Setup notification content.
     builder.setSmallIcon( yourIconResourceId );
     builder.setContentTitle("Your notification title");
     builder.setContentText("Your notification content.");

     // Set notification as insistent to cause your ringtone to loop.
     Notification notification = builder.build();
     notification.flags |= Notification.FLAG_INSISTENT;

     // Use builder.addAction(..) to add buttons to answer or reject the call.
     NotificationManager notificationManager = mContext.getSystemService(
         NotificationManager.class);
     notificationManager.notify(YOUR_CHANNEL_ID, YOUR_TAG, YOUR_ID, notification);
 

onSilence

Added in API level 29
public void onSilence ()

Notifies this Connection of a request to silence the ringer.

The ringer may be silenced by any of the following methods:

Self-managed ConnectionService implementations should override this method in their Connection implementation and implement logic to silence their app's ringtone. If your app set the ringtone as part of the incoming call Notification (see onShowIncomingCallUi()), it should re-post the notification now, except call Notification.Builder.setOnlyAlertOnce(boolean) with true. This will ensure the ringtone sound associated with your NotificationChannel stops playing.

onStartRtt

Added in API level 28
public void onStartRtt (Connection.RttTextStream rttTextStream)

Notifies this Connection that the user has requested an RTT session. The connection service should call sendRttInitiationSuccess() or sendRttInitiationFailure(int) to inform Telecom of the success or failure of the request, respectively.

Parameters
rttTextStream Connection.RttTextStream: The object that should be used to send text to or receive text from the in-call app. This value cannot be null.

onStateChanged

Added in API level 23
public void onStateChanged (int state)

Notifies this Connection of an internal state change. This method is called after the state is changed.

Parameters
state int: The new state, one of the STATE_* constants.

onStopDtmfTone

Added in API level 23
public void onStopDtmfTone ()

Notifies this Connection of a request to stop any currently playing DTMF tones.

onStopRtt

Added in API level 28
public void onStopRtt ()

Notifies this Connection that it should terminate any existing RTT communication channel. No response to Telecom is needed for this method.

onTrackedByNonUiService

Added in API level 31
public void onTrackedByNonUiService (boolean isTracked)

Inform this Conenection when it will or will not be tracked by an non-UI InCallService.

Parameters
isTracked boolean: Indicates whether an non-UI InCallService is currently tracking the self-managed call.

onUnhold

Added in API level 23
public void onUnhold ()

Notifies this Connection of a request to exit a hold state.

onUsingAlternativeUi

Added in API level 31
public void onUsingAlternativeUi (boolean isUsingAlternativeUi)

Inform this Connection when it will or will not be tracked by an InCallService which can provide an InCall UI. This is primarily intended for use by Connections reported by self-managed ConnectionService which typically maintain their own UI.

Parameters
isUsingAlternativeUi boolean: Indicates whether an InCallService that can provide InCall UI is currently tracking the self-managed call.

propertiesToString

Added in API level 25
public static String propertiesToString (int properties)

Renders a set of property bits (PROPERTY_*) as a human readable string.

Parameters
properties int: A property bit field.

Returns
String A human readable string representation.

putExtras

Added in API level 25
public final void putExtras (Bundle extras)

Adds some extras to this Connection. Existing keys are replaced and new ones are added.

No assumptions should be made as to how an In-Call UI or service will handle these extras. Keys should be fully qualified (e.g., com.example.MY_EXTRA) to avoid conflicts.

Parameters
extras Bundle: The extras to add. This value cannot be null.

queryLocationForEmergency

Added in API level 34
public final void queryLocationForEmergency (long timeoutMillis, 
                String provider, 
                Executor executor, 
                OutcomeReceiver<LocationQueryLocationException> callback)

Query the device's location in order to place an Emergency Call. Only SIM call managers can call this method for Connections representing Emergency calls. If a previous location query request is not completed, the new location query request will be rejected and return a QueryLocationException with QueryLocationException#ERROR_PREVIOUS_REQUEST_EXISTS

Parameters
timeoutMillis long: long: Timeout in millis waiting for query response (MAX:5000, MIN:100). Value is between 100 and 5000 inclusive

provider String: String: the location provider name, This value cannot be null. It is the caller's responsibility to select an enabled provider. The caller can use LocationManager.getProviders(boolean) to choose one of the enabled providers and pass it in.

executor Executor: The executor of where the callback will execute. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

callback OutcomeReceiver: The callback to notify the result of queryLocation. This value cannot be null.

removeExtras

Added in API level 25
public final void removeExtras (List<String> keys)

Removes extras from this Connection.

Parameters
keys List: The keys of the extras to remove.

removeExtras

Added in API level 25
public final void removeExtras (String... keys)

Removes extras from this Connection.

Parameters
keys String: The keys of the extras to remove.

requestBluetoothAudio

Added in API level 28
Deprecated in API level 34
public void requestBluetoothAudio (BluetoothDevice bluetoothDevice)

This method was deprecated in API level 34.
Use requestCallEndpointChange(android.telecom.CallEndpoint, java.util.concurrent.Executor, android.os.OutcomeReceiver) instead.

Request audio routing to a specific bluetooth device. Calling this method may result in the device routing audio to a different bluetooth device than the one specified if the bluetooth stack is unable to route audio to the requested device. A list of available devices can be obtained via CallAudioState#getSupportedBluetoothDevices()

Used by self-managed ConnectionServices which wish to use bluetooth audio for a self-managed Connection (see PhoneAccount#CAPABILITY_SELF_MANAGED.)

See also InCallService#requestBluetoothAudio(BluetoothDevice)

Parameters
bluetoothDevice BluetoothDevice: The bluetooth device to connect to. This value cannot be null.

requestCallEndpointChange

Added in API level 34
public final void requestCallEndpointChange (CallEndpoint endpoint, 
                Executor executor, 
                OutcomeReceiver<VoidCallEndpointException> callback)

Request audio routing to a specific CallEndpoint. Clients should not define their own CallEndpoint when requesting a change. Instead, the new endpoint should be one of the valid endpoints provided by onAvailableCallEndpointsChanged(java.util.List). When this request is honored, there will be change to the getCurrentCallEndpoint().

Used by self-managed ConnectionServices which wish to change the CallEndpoint for a self-managed Connection (see PhoneAccount#CAPABILITY_SELF_MANAGED.)

See also InCallService#requestCallEndpointChange(CallEndpoint, Executor, OutcomeReceiver).

Parameters
endpoint CallEndpoint: The call endpoint to use. This value cannot be null.

executor Executor: The executor of where the callback will execute. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

callback OutcomeReceiver: The callback to notify the result of the endpoint change. This value cannot be null.

sendConnectionEvent

Added in API level 25
public void sendConnectionEvent (String event, 
                Bundle extras)

Sends an event associated with this Connection with associated event extras to the InCallService.

Connection events are used to communicate point in time information from a ConnectionService to a InCallService implementations. An example of a custom connection event includes notifying the UI when a WIFI call has been handed over to LTE, which the InCall UI might use to inform the user that billing charges may apply. The Android Telephony framework will send the EVENT_CALL_MERGE_FAILED connection event when a call to Call#mergeConference() has failed to complete successfully. A connection event could also be used to trigger UI in the InCallService which prompts the user to make a choice (e.g. whether they want to incur roaming costs for making a call), which is communicated back via Call#sendCallEvent(String, Bundle).

Events are exposed to InCallService implementations via Call.Callback#onConnectionEvent(Call, String, Bundle).

No assumptions should be made as to how an In-Call UI or service will handle these events. The ConnectionService must assume that the In-Call UI could even chose to ignore some events altogether.

Events should be fully qualified (e.g. com.example.event.MY_EVENT) to avoid conflicts between ConnectionService implementations. Further, custom ConnectionService implementations shall not re-purpose events in the android.* namespace, nor shall they define new event types in this namespace. When defining a custom event type, ensure the contents of the extras Bundle is clearly defined. Extra keys for this bundle should be named similar to the event type (e.g. com.example.extra.MY_EXTRA).

When defining events and the associated extras, it is important to keep their behavior consistent when the associated ConnectionService is updated. Support for deprecated events/extras should me maintained to ensure backwards compatibility with older InCallService implementations which were built to support the older behavior.

Parameters
event String: The connection event.

extras Bundle: Optional bundle containing extra information associated with the event.

sendRemoteRttRequest

Added in API level 28
public final void sendRemoteRttRequest ()

Informs listeners that the remote side of the call has requested an upgrade to include an RTT session in the call.

sendRttInitiationFailure

Added in API level 28
public final void sendRttInitiationFailure (int reason)

Informs listeners that a previously requested RTT session via ConnectionRequest#isRequestingRtt() or onStartRtt(android.telecom.Connection.RttTextStream) has failed.

Parameters
reason int: One of the reason codes defined in RttModifyStatus, with the exception of RttModifyStatus#SESSION_MODIFY_REQUEST_SUCCESS.

sendRttInitiationSuccess

Added in API level 28
public final void sendRttInitiationSuccess ()

Informs listeners that a previously requested RTT session via ConnectionRequest#isRequestingRtt() or onStartRtt(android.telecom.Connection.RttTextStream) has succeeded.

sendRttSessionRemotelyTerminated

Added in API level 28
public final void sendRttSessionRemotelyTerminated ()

Informs listeners that a currently active RTT session has been terminated by the remote side of the coll.

setActive

Added in API level 23
public final void setActive ()

Sets state to active (e.g., an ongoing connection where two or more parties can actively communicate).

setAddress

Added in API level 23
public final void setAddress (Uri address, 
                int presentation)

Sets the value of the getAddress() property.

Parameters
address Uri: The new address.

presentation int: The presentation requirements for the address. See TelecomManager for valid values.

setAudioModeIsVoip

Added in API level 23
public final void setAudioModeIsVoip (boolean isVoip)

Requests that the framework use VOIP audio mode for this connection.

Parameters
isVoip boolean: True if the audio mode is VOIP.

setAudioRoute

Added in API level 26
Deprecated in API level 34
public final void setAudioRoute (int route)

This method was deprecated in API level 34.
Use requestCallEndpointChange(android.telecom.CallEndpoint, java.util.concurrent.Executor, android.os.OutcomeReceiver) instead.

Sets the audio route (speaker, bluetooth, etc...). When this request is honored, there will be change to the getCallAudioState().

Used by self-managed ConnectionServices which wish to change the audio route for a self-managed Connection (see PhoneAccount#CAPABILITY_SELF_MANAGED.)

See also InCallService#setAudioRoute(int).

Parameters
route int: The audio route to use (one of CallAudioState#ROUTE_BLUETOOTH, CallAudioState#ROUTE_EARPIECE, CallAudioState#ROUTE_SPEAKER, or CallAudioState#ROUTE_WIRED_HEADSET).

setCallerDisplayName

Added in API level 23
public final void setCallerDisplayName (String callerDisplayName, 
                int presentation)

Sets the caller display name (CNAP).

Parameters
callerDisplayName String: The new display name.

presentation int: The presentation requirements for the handle. See TelecomManager for valid values.

setCallerNumberVerificationStatus

Added in API level 30
public final void setCallerNumberVerificationStatus (int callerNumberVerificationStatus)

Sets the verification status for the phone number of an incoming call as identified in ATIS-1000082.

This property can only be set at the time of creation of a Connection being returned by ConnectionService#onCreateIncomingConnection(PhoneAccountHandle, ConnectionRequest).

Parameters
callerNumberVerificationStatus int: Value is VERIFICATION_STATUS_NOT_VERIFIED, VERIFICATION_STATUS_PASSED, or VERIFICATION_STATUS_FAILED

setConferenceableConnections

Added in API level 23
public final void setConferenceableConnections (List<Connection> conferenceableConnections)

Sets the connections with which this connection can be conferenced.

Parameters
conferenceableConnections List: The set of connections this connection can conference with.

setConferenceables

Added in API level 23
public final void setConferenceables (List<Conferenceable> conferenceables)

Similar to setConferenceableConnections(java.util.List), sets a list of connections or conferences with which this connection can be conferenced.

Parameters
conferenceables List: The conferenceables.

setConnectionCapabilities

Added in API level 23
public final void setConnectionCapabilities (int connectionCapabilities)

Sets the connection's capabilities as a bit mask of the CAPABILITY_* constants.

Parameters
connectionCapabilities int: The new connection capabilities.

setConnectionProperties

Added in API level 25
public final void setConnectionProperties (int connectionProperties)

Sets the connection's properties as a bit mask of the PROPERTY_* constants.

Parameters
connectionProperties int: The new connection properties.

setDialing

Added in API level 23
public final void setDialing ()

Sets state to dialing (e.g., dialing an outbound connection).

setDisconnected

Added in API level 23
public final void setDisconnected (DisconnectCause disconnectCause)

Sets state to disconnected.

Parameters
disconnectCause DisconnectCause: The reason for the disconnection, as specified by DisconnectCause.

setExtras

Added in API level 23
public final void setExtras (Bundle extras)

Set some extras that can be associated with this Connection.

New or existing keys are replaced in the Connection extras. Keys which are no longer in the new extras, but were present the last time setExtras was called are removed.

Alternatively you may use the putExtras(android.os.Bundle), and removeExtras(java.lang.String) methods to modify the extras.

No assumptions should be made as to how an In-Call UI or service will handle these extras. Keys should be fully qualified (e.g., com.example.MY_EXTRA) to avoid conflicts.

Parameters
extras Bundle: The extras associated with this Connection. This value may be null.

setInitialized

Added in API level 23
public final void setInitialized ()

Sets state to initialized (the Connection has been set up and is now ready to be used).

setInitializing

Added in API level 23
public final void setInitializing ()

Sets state to initializing (this Connection is not yet ready to be used).

setNextPostDialChar

Added in API level 23
public final void setNextPostDialChar (char nextChar)

Informs listeners that this Connection has processed a character in the post-dial started state. This is done when (a) the Connection is issuing a DTMF sequence; and (b) it wishes to signal Telecom to play the corresponding DTMF tone locally.

Parameters
nextChar char: The DTMF character that was just processed by the Connection.

setOnHold

Added in API level 23
public final void setOnHold ()

Sets state to be on hold.

setPostDialWait

Added in API level 23
public final void setPostDialWait (String remaining)

Informs listeners that this Connection is in a post-dial wait state. This is done when (a) the Connection is issuing a DTMF sequence; (b) it has encountered a "wait" character; and (c) it wishes to inform the In-Call app that it is waiting for the end-user to send an onPostDialContinue(boolean) signal.

Parameters
remaining String: The DTMF character sequence remaining to be emitted once the onPostDialContinue(boolean) is received, including any "wait" characters that remaining sequence may contain.

setPulling

Added in API level 25
public final void setPulling ()

Sets state to pulling (e.g. the connection is being pulled to the local device from another device). Only applicable for Connections with Connection#PROPERTY_IS_EXTERNAL_CALL and Connection#CAPABILITY_CAN_PULL_CALL.

setRingbackRequested

Added in API level 23
public final void setRingbackRequested (boolean ringback)

Requests that the framework play a ringback tone. This is to be invoked by implementations that do not play a ringback tone themselves in the connection's audio stream.

Parameters
ringback boolean: Whether the ringback tone is to be played.

setRinging

Added in API level 23
public final void setRinging ()

Sets state to ringing (e.g., an inbound ringing connection).

setStatusHints

Added in API level 23
public final void setStatusHints (StatusHints statusHints)

Sets the label and icon status to display in the in-call UI.

Parameters
statusHints StatusHints: The status label and icon to set.

setVideoProvider

Added in API level 23
public final void setVideoProvider (Connection.VideoProvider videoProvider)

Sets the video connection provider.

Parameters
videoProvider Connection.VideoProvider: The video provider.

setVideoState

Added in API level 23
public final void setVideoState (int videoState)

Set the video state for the connection. Valid values: VideoProfile#STATE_AUDIO_ONLY, VideoProfile#STATE_BIDIRECTIONAL, VideoProfile#STATE_TX_ENABLED, VideoProfile#STATE_RX_ENABLED.

Parameters
videoState int: The new video state.

stateToString

Added in API level 23
public static String stateToString (int state)

Parameters
state int: An integer value of a STATE_* constant.

Returns
String A string representation of the value.