Methods Summary |
---|
public void | addCapability(int capability)Adds the specified capability to the set of capabilities of this {@code Connection}.
mConnectionCapabilities |= capability;
|
public final android.telecom.Connection | addConnectionListener(android.telecom.Connection$Listener l)Assign a listener to be notified of state changes.
mListeners.add(l);
return this;
|
public static boolean | can(int capabilities, int capability)Whether the given capabilities support the specified capability.
return (capabilities & capability) != 0;
|
public boolean | can(int capability)Whether the capabilities of this {@code Connection} supports the specified capability.
return can(mConnectionCapabilities, capability);
|
public static java.lang.String | capabilitiesToString(int capabilities)
StringBuilder builder = new StringBuilder();
builder.append("[Capabilities:");
if (can(capabilities, CAPABILITY_HOLD)) {
builder.append(" CAPABILITY_HOLD");
}
if (can(capabilities, CAPABILITY_SUPPORT_HOLD)) {
builder.append(" CAPABILITY_SUPPORT_HOLD");
}
if (can(capabilities, CAPABILITY_MERGE_CONFERENCE)) {
builder.append(" CAPABILITY_MERGE_CONFERENCE");
}
if (can(capabilities, CAPABILITY_SWAP_CONFERENCE)) {
builder.append(" CAPABILITY_SWAP_CONFERENCE");
}
if (can(capabilities, CAPABILITY_RESPOND_VIA_TEXT)) {
builder.append(" CAPABILITY_RESPOND_VIA_TEXT");
}
if (can(capabilities, CAPABILITY_MUTE)) {
builder.append(" CAPABILITY_MUTE");
}
if (can(capabilities, CAPABILITY_MANAGE_CONFERENCE)) {
builder.append(" CAPABILITY_MANAGE_CONFERENCE");
}
if (can(capabilities, CAPABILITY_SUPPORTS_VT_LOCAL)) {
builder.append(" CAPABILITY_SUPPORTS_VT_LOCAL");
}
if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE)) {
builder.append(" CAPABILITY_SUPPORTS_VT_REMOTE");
}
if (can(capabilities, CAPABILITY_HIGH_DEF_AUDIO)) {
builder.append(" CAPABILITY_HIGH_DEF_AUDIO");
}
if (can(capabilities, CAPABILITY_VoWIFI)) {
builder.append(" CAPABILITY_VoWIFI");
}
if (can(capabilities, CAPABILITY_GENERIC_CONFERENCE)) {
builder.append(" CAPABILITY_GENERIC_CONFERENCE");
}
builder.append("]");
return builder.toString();
|
public void | checkImmutable()Override to throw an {@link UnsupportedOperationException} if this {@code Connection} is
not intended to be mutated, e.g., if it is a marker for failure. Only for framework use;
this should never be un-@hide-den.
|
private final void | clearConferenceableList()
for (IConferenceable c : mConferenceables) {
if (c instanceof Connection) {
Connection connection = (Connection) c;
connection.removeConnectionListener(mConnectionDeathListener);
} else if (c instanceof Conference) {
Conference conference = (Conference) c;
conference.removeListener(mConferenceDeathListener);
}
}
mConferenceables.clear();
|
public static android.telecom.Connection | createCanceledConnection()Return a {@code Connection} which represents a canceled connection attempt. The returned
{@code Connection} will have state {@link #STATE_DISCONNECTED}, and cannot be moved out of
that state. This connection should not be used for anything, and no other
{@code Connection}s should be attempted.
so users of this method need not maintain a reference to its return value to destroy it.
return new FailureSignalingConnection(new DisconnectCause(DisconnectCause.CANCELED));
|
public static android.telecom.Connection | createFailedConnection(DisconnectCause disconnectCause)Return a {@code Connection} which represents a failed connection attempt. The returned
{@code Connection} will have a {@link android.telecom.DisconnectCause} and as specified,
and a {@link #getState()} of {@link #STATE_DISCONNECTED}.
The returned {@code Connection} can be assumed to {@link #destroy()} itself when appropriate,
so users of this method need not maintain a reference to its return value to destroy it.
return new FailureSignalingConnection(disconnectCause);
|
public final void | destroy()Tears down the Connection object.
for (Listener l : mListeners) {
l.onDestroyed(this);
}
|
private final void | fireConferenceChanged()
for (Listener l : mListeners) {
l.onConferenceChanged(this, mConference);
}
|
private final void | fireOnConferenceableConnectionsChanged()
for (Listener l : mListeners) {
l.onConferenceablesChanged(this, getConferenceables());
}
|
public final android.net.Uri | getAddress()
return mAddress;
|
public final int | getAddressPresentation()
return mAddressPresentation;
|
public final boolean | getAudioModeIsVoip()
return mAudioModeIsVoip;
|
public final AudioState | getAudioState()
return mAudioState;
|
public final int | getCallCapabilities()
return getConnectionCapabilities();
|
public final java.lang.String | getCallerDisplayName()
return mCallerDisplayName;
|
public final int | getCallerDisplayNamePresentation()
return mCallerDisplayNamePresentation;
|
public final Conference | getConference()
return mConference;
|
public final java.util.List | getConferenceables()Returns the connections or conferences with which this connection can be conferenced.
return mUnmodifiableConferenceables;
|
public final int | getConnectionCapabilities()Returns the connection's capabilities, as a bit mask of the {@code CAPABILITY_*} constants.
return mConnectionCapabilities;
|
public final ConnectionService | getConnectionService()
return mConnectionService;
|
public final DisconnectCause | getDisconnectCause()
return mDisconnectCause;
|
public final int | getState()
return mState;
|
public final StatusHints | getStatusHints()
return mStatusHints;
|
public final android.telecom.Connection$VideoProvider | getVideoProvider()
return mVideoProvider;
|
public final int | getVideoState()Returns the video state of the connection.
Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY},
{@link VideoProfile.VideoState#BIDIRECTIONAL},
{@link VideoProfile.VideoState#TX_ENABLED},
{@link VideoProfile.VideoState#RX_ENABLED}.
return mVideoState;
|
public final boolean | isRingbackRequested()Returns whether this connection is requesting that the system play a ringback tone
on its behalf.
return mRingbackRequested;
|
protected void | notifyConferenceStarted()Notifies listeners that a conference call has been started.
for (Listener l : mListeners) {
l.onConferenceStarted();
}
|
public void | onAbort()Notifies this Connection of a request to abort.
|
public void | onAnswer(int videoState)Notifies this Connection, which is in {@link #STATE_RINGING}, of
a request to accept.
|
public void | onAnswer()Notifies this Connection, which is in {@link #STATE_RINGING}, of
a request to accept.
onAnswer(VideoProfile.VideoState.AUDIO_ONLY);
|
public void | onAudioStateChanged(AudioState state)Notifies this Connection that the {@link #getAudioState()} property has a new value.
|
public void | onDisconnect()Notifies this Connection of a request to disconnect.
|
public void | onDisconnectConferenceParticipant(android.net.Uri endpoint)Notifies this Connection of a request to disconnect a participant of the conference managed
by the connection.
|
public void | onHold()Notifies this Connection of a request to hold.
|
public void | onPlayDtmfTone(char c)Notifies this Connection of a request to play a DTMF tone.
|
public void | onPostDialContinue(boolean proceed)Notifies this Connection whether the user wishes to proceed with the post-dial DTMF codes.
|
public void | onReject()Notifies this Connection, which is in {@link #STATE_RINGING}, of
a request to reject.
|
public void | onSeparate()Notifies this Connection of a request to separate from its parent conference.
|
public void | onStateChanged(int state)Notifies this Connection of an internal state change. This method is called after the
state is changed.
|
public void | onStopDtmfTone()Notifies this Connection of a request to stop any currently playing DTMF tones.
|
public void | onUnhold()Notifies this Connection of a request to exit a hold state.
|
public void | removeCapability(int capability)Removes the specified capability from the set of capabilities of this {@code Connection}.
mConnectionCapabilities &= ~capability;
|
public final android.telecom.Connection | removeConnectionListener(android.telecom.Connection$Listener l)Remove a previously assigned listener that was being notified of state changes.
if (l != null) {
mListeners.remove(l);
}
return this;
|
public final void | resetConference()Resets the conference that this connection is a part of.
if (mConference != null) {
Log.d(this, "Conference reset");
mConference = null;
fireConferenceChanged();
}
|
public final void | setActive()Sets state to active (e.g., an ongoing connection where two or more parties can actively
communicate).
checkImmutable();
setRingbackRequested(false);
setState(STATE_ACTIVE);
|
public final void | setAddress(android.net.Uri address, int presentation)Sets the value of the {@link #getAddress()} property.
checkImmutable();
Log.d(this, "setAddress %s", address);
mAddress = address;
mAddressPresentation = presentation;
for (Listener l : mListeners) {
l.onAddressChanged(this, address, presentation);
}
|
public final void | setAudioModeIsVoip(boolean isVoip)Requests that the framework use VOIP audio mode for this connection.
checkImmutable();
mAudioModeIsVoip = isVoip;
for (Listener l : mListeners) {
l.onAudioModeIsVoipChanged(this, isVoip);
}
|
final void | setAudioState(AudioState state)Inform this Connection that the state of its audio output has been changed externally.
checkImmutable();
Log.d(this, "setAudioState %s", state);
mAudioState = state;
onAudioStateChanged(state);
|
public final void | setCallCapabilities(int connectionCapabilities)
setConnectionCapabilities(connectionCapabilities);
|
public final void | setCallerDisplayName(java.lang.String callerDisplayName, int presentation)Sets the caller display name (CNAP).
checkImmutable();
Log.d(this, "setCallerDisplayName %s", callerDisplayName);
mCallerDisplayName = callerDisplayName;
mCallerDisplayNamePresentation = presentation;
for (Listener l : mListeners) {
l.onCallerDisplayNameChanged(this, callerDisplayName, presentation);
}
|
public final boolean | setConference(Conference conference)Sets the conference that this connection is a part of. This will fail if the connection is
already part of a conference. {@link #resetConference} to un-set the conference first.
checkImmutable();
// We check to see if it is already part of another conference.
if (mConference == null) {
mConference = conference;
if (mConnectionService != null && mConnectionService.containsConference(conference)) {
fireConferenceChanged();
}
return true;
}
return false;
|
public final void | setConferenceableConnections(java.util.List conferenceableConnections)Sets the connections with which this connection can be conferenced.
checkImmutable();
clearConferenceableList();
for (Connection c : conferenceableConnections) {
// If statement checks for duplicates in input. It makes it N^2 but we're dealing with a
// small amount of items here.
if (!mConferenceables.contains(c)) {
c.addConnectionListener(mConnectionDeathListener);
mConferenceables.add(c);
}
}
fireOnConferenceableConnectionsChanged();
|
public final void | setConferenceables(java.util.List conferenceables)Similar to {@link #setConferenceableConnections(java.util.List)}, sets a list of connections
or conferences with which this connection can be conferenced.
clearConferenceableList();
for (IConferenceable c : conferenceables) {
// If statement checks for duplicates in input. It makes it N^2 but we're dealing with a
// small amount of items here.
if (!mConferenceables.contains(c)) {
if (c instanceof Connection) {
Connection connection = (Connection) c;
connection.addConnectionListener(mConnectionDeathListener);
} else if (c instanceof Conference) {
Conference conference = (Conference) c;
conference.addListener(mConferenceDeathListener);
}
mConferenceables.add(c);
}
}
fireOnConferenceableConnectionsChanged();
|
public final void | setConnectionCapabilities(int connectionCapabilities)Sets the connection's capabilities as a bit mask of the {@code CAPABILITY_*} constants.
checkImmutable();
if (mConnectionCapabilities != connectionCapabilities) {
mConnectionCapabilities = connectionCapabilities;
for (Listener l : mListeners) {
l.onConnectionCapabilitiesChanged(this, mConnectionCapabilities);
}
}
|
public final void | setConnectionService(ConnectionService connectionService)
checkImmutable();
if (mConnectionService != null) {
Log.e(this, new Exception(), "Trying to set ConnectionService on a connection " +
"which is already associated with another ConnectionService.");
} else {
mConnectionService = connectionService;
}
|
public final void | setDialing()Sets state to dialing (e.g., dialing an outbound connection).
checkImmutable();
setState(STATE_DIALING);
|
public final void | setDisconnected(DisconnectCause disconnectCause)Sets state to disconnected.
checkImmutable();
mDisconnectCause = disconnectCause;
setState(STATE_DISCONNECTED);
Log.d(this, "Disconnected with cause %s", disconnectCause);
for (Listener l : mListeners) {
l.onDisconnected(this, disconnectCause);
}
|
public final void | setInitialized()Sets state to initialized (the Connection has been set up and is now ready to be used).
checkImmutable();
setState(STATE_NEW);
|
public final void | setInitializing()Sets state to initializing (this Connection is not yet ready to be used).
checkImmutable();
setState(STATE_INITIALIZING);
|
public final void | setNextPostDialWaitChar(char nextChar)Informs listeners that this {@code Connection} has processed a character in the post-dial
started state. This is done when (a) the {@code Connection} is issuing a DTMF sequence;
(b) it has encountered a "wait" character; and (c) it wishes to signal Telecom to play
the corresponding DTMF tone locally.
checkImmutable();
for (Listener l : mListeners) {
l.onPostDialChar(this, nextChar);
}
|
public final void | setOnHold()Sets state to be on hold.
checkImmutable();
setState(STATE_HOLDING);
|
public final void | setPostDialWait(java.lang.String remaining)Informs listeners that this {@code Connection} is in a post-dial wait state. This is done
when (a) the {@code 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 {@link #onPostDialContinue(boolean)} signal.
checkImmutable();
for (Listener l : mListeners) {
l.onPostDialWait(this, remaining);
}
|
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.
checkImmutable();
if (mRingbackRequested != ringback) {
mRingbackRequested = ringback;
for (Listener l : mListeners) {
l.onRingbackRequested(this, ringback);
}
}
|
public final void | setRinging()Sets state to ringing (e.g., an inbound ringing connection).
checkImmutable();
setState(STATE_RINGING);
|
private void | setState(int state)
checkImmutable();
if (mState == STATE_DISCONNECTED && mState != state) {
Log.d(this, "Connection already DISCONNECTED; cannot transition out of this state.");
return;
}
if (mState != state) {
Log.d(this, "setState: %s", stateToString(state));
mState = state;
onStateChanged(state);
for (Listener l : mListeners) {
l.onStateChanged(this, state);
}
}
|
public final void | setStatusHints(StatusHints statusHints)Sets the label and icon status to display in the in-call UI.
checkImmutable();
mStatusHints = statusHints;
for (Listener l : mListeners) {
l.onStatusHintsChanged(this, statusHints);
}
|
public final void | setVideoProvider(android.telecom.Connection$VideoProvider videoProvider)Sets the video connection provider.
checkImmutable();
mVideoProvider = videoProvider;
for (Listener l : mListeners) {
l.onVideoProviderChanged(this, videoProvider);
}
|
public final void | setVideoState(int videoState)Set the video state for the connection.
Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY},
{@link VideoProfile.VideoState#BIDIRECTIONAL},
{@link VideoProfile.VideoState#TX_ENABLED},
{@link VideoProfile.VideoState#RX_ENABLED}.
checkImmutable();
Log.d(this, "setVideoState %d", videoState);
mVideoState = videoState;
for (Listener l : mListeners) {
l.onVideoStateChanged(this, mVideoState);
}
|
public static java.lang.String | stateToString(int state)
switch (state) {
case STATE_INITIALIZING:
return "STATE_INITIALIZING";
case STATE_NEW:
return "STATE_NEW";
case STATE_RINGING:
return "STATE_RINGING";
case STATE_DIALING:
return "STATE_DIALING";
case STATE_ACTIVE:
return "STATE_ACTIVE";
case STATE_HOLDING:
return "STATE_HOLDING";
case STATE_DISCONNECTED:
return "DISCONNECTED";
default:
Log.wtf(Connection.class, "Unknown state %d", state);
return "UNKNOWN";
}
|
static java.lang.String | toLogSafePhoneNumber(java.lang.String number)
// For unknown number, log empty string.
if (number == null) {
return "";
}
if (PII_DEBUG) {
// When PII_DEBUG is true we emit PII.
return number;
}
// Do exactly same thing as Uri#toSafeString() does, which will enable us to compare
// sanitized phone numbers.
StringBuilder builder = new StringBuilder();
for (int i = 0; i < number.length(); i++) {
char c = number.charAt(i);
if (c == '-" || c == '@" || c == '.") {
builder.append(c);
} else {
builder.append('x");
}
}
return builder.toString();
|
public final void | unsetConnectionService(ConnectionService connectionService)
if (mConnectionService != connectionService) {
Log.e(this, new Exception(), "Trying to remove ConnectionService from a Connection " +
"that does not belong to the ConnectionService.");
} else {
mConnectionService = null;
}
|
protected final void | updateConferenceParticipants(java.util.List conferenceParticipants)Notifies listeners of a change to conference participant(s).
for (Listener l : mListeners) {
l.onConferenceParticipantsChanged(this, conferenceParticipants);
}
|