diff --git a/telecomm/java/android/telecom/AudioState.java b/telecomm/java/android/telecom/AudioState.java index f78ce29b655d4..bd63e00c4befe 100644 --- a/telecomm/java/android/telecom/AudioState.java +++ b/telecomm/java/android/telecom/AudioState.java @@ -54,25 +54,25 @@ public final class AudioState implements Parcelable { public static final int ROUTE_ALL = ROUTE_EARPIECE | ROUTE_BLUETOOTH | ROUTE_WIRED_HEADSET | ROUTE_SPEAKER; - /** True if the call is muted, false otherwise. */ - public final boolean isMuted; + /** @hide */ + @Deprecated public final boolean isMuted; - /** The current audio route being used. */ - public final int route; + /** @hide */ + @Deprecated public final int route; - /** Bit mask of all routes supported by this call. */ - public final int supportedRouteMask; + /** @hide */ + @Deprecated public final int supportedRouteMask; - public AudioState(boolean isMuted, int route, int supportedRouteMask) { - this.isMuted = isMuted; + public AudioState(boolean muted, int route, int supportedRouteMask) { + this.isMuted = muted; this.route = route; this.supportedRouteMask = supportedRouteMask; } public AudioState(AudioState state) { - isMuted = state.isMuted; - route = state.route; - supportedRouteMask = state.supportedRouteMask; + isMuted = state.isMuted(); + route = state.getRoute(); + supportedRouteMask = state.getSupportedRouteMask(); } @Override @@ -84,15 +84,17 @@ public final class AudioState implements Parcelable { return false; } AudioState state = (AudioState) obj; - return isMuted == state.isMuted && route == state.route && - supportedRouteMask == state.supportedRouteMask; + return isMuted() == state.isMuted() && getRoute() == state.getRoute() && + getSupportedRouteMask() == state.getSupportedRouteMask(); } @Override public String toString() { return String.format(Locale.US, "[AudioState isMuted: %b, route; %s, supportedRouteMask: %s]", - isMuted, audioRouteToString(route), audioRouteToString(supportedRouteMask)); + isMuted, + audioRouteToString(route), + audioRouteToString(supportedRouteMask)); } /** @hide */ @@ -162,4 +164,25 @@ public final class AudioState implements Parcelable { destination.writeInt(route); destination.writeInt(supportedRouteMask); } + + /** + * @return {@code true} if the call is muted, false otherwise. + */ + public boolean isMuted() { + return isMuted; + } + + /** + * @return The current audio route being used. + */ + public int getRoute() { + return route; + } + + /** + * @return Bit mask of all routes supported by this call. + */ + public int getSupportedRouteMask() { + return supportedRouteMask; + } } diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index 354fa2ee6498d..7df40f1abf4f5 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -97,6 +97,91 @@ public final class Call { public static final String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts"; public static class Details { + + /** Call can currently be put on hold or unheld. */ + public static final int CAPABILITY_HOLD = 0x00000001; + + /** Call supports the hold feature. */ + public static final int CAPABILITY_SUPPORT_HOLD = 0x00000002; + + /** + * Calls within a conference can be merged. A {@link ConnectionService} has the option to + * add a {@link Conference} call before the child {@link Connection}s are merged. This is how + * CDMA-based {@link Connection}s are implemented. For these unmerged {@link Conference}s, this + * capability allows a merge button to be shown while the conference call is in the foreground + * of the in-call UI. + *
+ * This is only intended for use by a {@link Conference}. + */ + public static final int CAPABILITY_MERGE_CONFERENCE = 0x00000004; + + /** + * Calls within a conference can be swapped between foreground and background. + * See {@link #CAPABILITY_MERGE_CONFERENCE} for additional information. + *
+ * This is only intended for use by a {@link Conference}.
+ */
+ public static final int CAPABILITY_SWAP_CONFERENCE = 0x00000008;
+
+ /**
+ * @hide
+ */
+ public static final int CAPABILITY_UNUSED = 0x00000010;
+
+ /** Call supports responding via text option. */
+ public static final int CAPABILITY_RESPOND_VIA_TEXT = 0x00000020;
+
+ /** Call can be muted. */
+ public static final int CAPABILITY_MUTE = 0x00000040;
+
+ /**
+ * Call supports conference call management. This capability only applies to {@link Conference}
+ * calls which can have {@link Connection}s as children.
+ */
+ public static final int CAPABILITY_MANAGE_CONFERENCE = 0x00000080;
+
+ /**
+ * Local device supports video telephony.
+ * @hide
+ */
+ public static final int CAPABILITY_SUPPORTS_VT_LOCAL = 0x00000100;
+
+ /**
+ * Remote device supports video telephony.
+ * @hide
+ */
+ public static final int CAPABILITY_SUPPORTS_VT_REMOTE = 0x00000200;
+
+ /**
+ * Call is using voice over LTE.
+ * @hide
+ */
+ public static final int CAPABILITY_VoLTE = 0x00000400;
+
+ /**
+ * Call is using voice over WIFI.
+ * @hide
+ */
+ public static final int CAPABILITY_VoWIFI = 0x00000800;
+
+ /**
+ * Call is able to be separated from its parent {@code Conference}, if any.
+ */
+ public static final int CAPABILITY_SEPARATE_FROM_CONFERENCE = 0x00001000;
+
+ /**
+ * Call is able to be individually disconnected when in a {@code Conference}.
+ */
+ public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 0x00002000;
+
+ /**
+ * Whether the call is a generic conference, where we do not know the precise state of
+ * participants in the conference (eg. on CDMA).
+ *
+ * @hide
+ */
+ public static final int CAPABILITY_GENERIC_CONFERENCE = 0x00004000;
+
private final Uri mHandle;
private final int mHandlePresentation;
private final String mCallerDisplayName;
@@ -111,6 +196,78 @@ public final class Call {
private final StatusHints mStatusHints;
private final Bundle mExtras;
+ /**
+ * Whether the supplied capabilities supports the specified capability.
+ *
+ * @param capabilities A bit field of capabilities.
+ * @param capability The capability to check capabilities for.
+ * @return Whether the specified capability is supported.
+ * @hide
+ */
+ public static boolean can(int capabilities, int capability) {
+ return (capabilities & capability) != 0;
+ }
+
+ /**
+ * Whether the capabilities of this {@code Details} supports the specified capability.
+ *
+ * @param capability The capability to check capabilities for.
+ * @return Whether the specified capability is supported.
+ * @hide
+ */
+ public boolean can(int capability) {
+ return can(mCallCapabilities, capability);
+ }
+
+ /**
+ * Render a set of capability bits ({@code CAPABILITY_*}) as a human readable string.
+ *
+ * @param capabilities A capability bit field.
+ * @return A human readable string representation.
+ */
+ public static 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_VoLTE)) {
+ builder.append(" CAPABILITY_VoLTE");
+ }
+ 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();
+ }
+
/**
* @return The handle (e.g., phone number) to which the {@code Call} is currently
* connected.
@@ -151,8 +308,8 @@ public final class Call {
}
/**
- * @return A bitmask of the capabilities of the {@code Call}, as defined in
- * {@link PhoneCapabilities}.
+ * @return A bitmask of the capabilities of the {@code Call}, as defined by the various
+ * {@code CAPABILITY_*} constants in this class.
*/
public int getCallCapabilities() {
return mCallCapabilities;
@@ -511,14 +668,14 @@ public final class Call {
}
/**
- * Merges the calls within this conference. See {@link PhoneCapabilities#MERGE_CONFERENCE}.
+ * Merges the calls within this conference. See {@link Details#CAPABILITY_MERGE_CONFERENCE}.
*/
public void mergeConference() {
mInCallAdapter.mergeConference(mTelecomCallId);
}
/**
- * Swaps the calls within this conference. See {@link PhoneCapabilities#SWAP_CONFERENCE}.
+ * Swaps the calls within this conference. See {@link Details#CAPABILITY_SWAP_CONFERENCE}.
*/
public void swapConference() {
mInCallAdapter.swapConference(mTelecomCallId);
diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java
index 6e404deb2619d..5371481325551 100644
--- a/telecomm/java/android/telecom/Conference.java
+++ b/telecomm/java/android/telecom/Conference.java
@@ -41,7 +41,8 @@ public abstract class Conference implements IConferenceable {
public void onConferenceableConnectionsChanged(
Conference conference, List
+ * This is only intended for use by a {@link Conference}.
+ */
+ public static final int CAPABILITY_MERGE_CONFERENCE = 0x00000004;
+
+ /**
+ * Connections within a conference can be swapped between foreground and background.
+ * See {@link #CAPABILITY_MERGE_CONFERENCE} for additional information.
+ *
+ * This is only intended for use by a {@link Conference}.
+ */
+ public static final int CAPABILITY_SWAP_CONFERENCE = 0x00000008;
+
+ /**
+ * @hide
+ */
+ public static final int CAPABILITY_UNUSED = 0x00000010;
+
+ /** Connection supports responding via text option. */
+ public static final int CAPABILITY_RESPOND_VIA_TEXT = 0x00000020;
+
+ /** Connection can be muted. */
+ public static final int CAPABILITY_MUTE = 0x00000040;
+
+ /**
+ * Connection supports conference management. This capability only applies to
+ * {@link Conference}s which can have {@link Connection}s as children.
+ */
+ public static final int CAPABILITY_MANAGE_CONFERENCE = 0x00000080;
+
+ /**
+ * Local device supports video telephony.
+ * @hide
+ */
+ public static final int CAPABILITY_SUPPORTS_VT_LOCAL = 0x00000100;
+
+ /**
+ * Remote device supports video telephony.
+ * @hide
+ */
+ public static final int CAPABILITY_SUPPORTS_VT_REMOTE = 0x00000200;
+
+ /**
+ * Connection is using voice over LTE.
+ * @hide
+ */
+ public static final int CAPABILITY_VoLTE = 0x00000400;
+
+ /**
+ * Connection is using voice over WIFI.
+ * @hide
+ */
+ public static final int CAPABILITY_VoWIFI = 0x00000800;
+
+ /**
+ * Connection is able to be separated from its parent {@code Conference}, if any.
+ */
+ public static final int CAPABILITY_SEPARATE_FROM_CONFERENCE = 0x00001000;
+
+ /**
+ * Connection is able to be individually disconnected when in a {@code Conference}.
+ */
+ public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 0x00002000;
+
+ /**
+ * Whether the call is a generic conference, where we do not know the precise state of
+ * participants in the conference (eg. on CDMA).
+ *
+ * @hide
+ */
+ public static final int CAPABILITY_GENERIC_CONFERENCE = 0x00004000;
+
// Flag controlling whether PII is emitted into the logs
private static final boolean PII_DEBUG = Log.isLoggable(android.util.Log.DEBUG);
+ /**
+ * Whether the given capabilities support the specified capability.
+ *
+ * @param capabilities A capability bit field.
+ * @param capability The capability to check capabilities for.
+ * @return Whether the specified capability is supported.
+ * @hide
+ */
+ public static boolean can(int capabilities, int capability) {
+ return (capabilities & capability) != 0;
+ }
+
+ /**
+ * Whether the capabilities of this {@code Connection} supports the specified capability.
+ *
+ * @param capability The capability to check capabilities for.
+ * @return Whether the specified capability is supported.
+ * @hide
+ */
+ public boolean can(int capability) {
+ return can(mConnectionCapabilities, capability);
+ }
+
+ /**
+ * Removes the specified capability from the set of capabilities of this {@code Connection}.
+ *
+ * @param capability The capability to remove from the set.
+ * @hide
+ */
+ public void removeCapability(int capability) {
+ mConnectionCapabilities &= ~capability;
+ }
+
+ /**
+ * Adds the specified capability to the set of capabilities of this {@code Connection}.
+ *
+ * @param capability The capability to add to the set.
+ * @hide
+ */
+ public void addCapability(int capability) {
+ mConnectionCapabilities |= capability;
+ }
+
+
+ public static 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_VoLTE)) {
+ builder.append(" CAPABILITY_VoLTE");
+ }
+ 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();
+ }
+
/** @hide */
public abstract static class Listener {
public void onStateChanged(Connection c, int state) {}
@@ -77,7 +248,7 @@ public abstract class Connection implements IConferenceable {
public void onPostDialWait(Connection c, String remaining) {}
public void onRingbackRequested(Connection c, boolean ringback) {}
public void onDestroyed(Connection c) {}
- public void onCallCapabilitiesChanged(Connection c, int callCapabilities) {}
+ public void onConnectionCapabilitiesChanged(Connection c, int capabilities) {}
public void onVideoProviderChanged(
Connection c, VideoProvider videoProvider) {}
public void onAudioModeIsVoipChanged(Connection c, boolean isVoip) {}
@@ -152,7 +323,7 @@ public abstract class Connection implements IConferenceable {
private static final int MSG_SEND_SESSION_MODIFY_REQUEST = 7;
private static final int MSG_SEND_SESSION_MODIFY_RESPONSE = 8;
private static final int MSG_REQUEST_CAMERA_CAPABILITIES = 9;
- private static final int MSG_REQUEST_CALL_DATA_USAGE = 10;
+ private static final int MSG_REQUEST_CONNECTION_DATA_USAGE = 10;
private static final int MSG_SET_PAUSE_IMAGE = 11;
private final VideoProvider.VideoProviderHandler
@@ -194,8 +365,8 @@ public abstract class Connection implements IConferenceable {
case MSG_REQUEST_CAMERA_CAPABILITIES:
onRequestCameraCapabilities();
break;
- case MSG_REQUEST_CALL_DATA_USAGE:
- onRequestCallDataUsage();
+ case MSG_REQUEST_CONNECTION_DATA_USAGE:
+ onRequestConnectionDataUsage();
break;
case MSG_SET_PAUSE_IMAGE:
onSetPauseImage((String) msg.obj);
@@ -250,7 +421,7 @@ public abstract class Connection implements IConferenceable {
}
public void requestCallDataUsage() {
- mMessageHandler.obtainMessage(MSG_REQUEST_CALL_DATA_USAGE).sendToTarget();
+ mMessageHandler.obtainMessage(MSG_REQUEST_CONNECTION_DATA_USAGE).sendToTarget();
}
public void setPauseImage(String uri) {
@@ -271,7 +442,7 @@ public abstract class Connection implements IConferenceable {
}
/**
- * Sets the camera to be used for video recording in a video call.
+ * Sets the camera to be used for video recording in a video connection.
*
* @param cameraId The id of the camera.
*/
@@ -311,19 +482,19 @@ public abstract class Connection implements IConferenceable {
/**
* Issues a request to modify the properties of the current session. The request is
* sent to the remote device where it it handled by the In-Call UI.
- * Some examples of session modification requests: upgrade call from audio to video,
- * downgrade call from video to audio, pause video.
+ * Some examples of session modification requests: upgrade connection from audio to video,
+ * downgrade connection from video to audio, pause video.
*
- * @param requestProfile The requested call video properties.
+ * @param requestProfile The requested connection video properties.
*/
public abstract void onSendSessionModifyRequest(VideoProfile requestProfile);
/**te
- * Provides a response to a request to change the current call session video
+ * Provides a response to a request to change the current connection session video
* properties.
* This is in response to a request the InCall UI has received via the InCall UI.
*
- * @param responseProfile The response call video properties.
+ * @param responseProfile The response connection video properties.
*/
public abstract void onSendSessionModifyResponse(VideoProfile responseProfile);
@@ -335,10 +506,10 @@ public abstract class Connection implements IConferenceable {
/**
* Issues a request to the video telephony framework to retrieve the cumulative data usage
- * for the current call. Data usage is reported back to the caller via the
+ * for the current connection. Data usage is reported back to the caller via the
* InCall UI.
*/
- public abstract void onRequestCallDataUsage();
+ public abstract void onRequestConnectionDataUsage();
/**
* Provides the video telephony framework with the URI of an image to be displayed to remote
@@ -351,7 +522,7 @@ public abstract class Connection implements IConferenceable {
/**
* Invokes callback method defined in In-Call UI.
*
- * @param videoProfile The requested video call profile.
+ * @param videoProfile The requested video connection profile.
*/
public void receiveSessionModifyRequest(VideoProfile videoProfile) {
if (mVideoCallback != null) {
@@ -482,7 +653,7 @@ public abstract class Connection implements IConferenceable {
private String mCallerDisplayName;
private int mCallerDisplayNamePresentation;
private boolean mRingbackRequested = false;
- private int mCallCapabilities;
+ private int mConnectionCapabilities;
private VideoProvider mVideoProvider;
private boolean mAudioModeIsVoip;
private StatusHints mStatusHints;
@@ -534,13 +705,13 @@ public abstract class Connection implements IConferenceable {
}
/**
- * Returns the video state of the call.
+ * 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 The video state of the call.
+ * @return The video state of the connection.
* @hide
*/
public final int getVideoState() {
@@ -548,7 +719,7 @@ public abstract class Connection implements IConferenceable {
}
/**
- * @return The audio state of the call, describing how its audio is currently
+ * @return The audio state of the connection, describing how its audio is currently
* being routed by the system. This is {@code null} if this Connection
* does not directly know about its audio state.
*/
@@ -628,6 +799,7 @@ public abstract class Connection implements IConferenceable {
* @hide
*/
final void setAudioState(AudioState state) {
+ checkImmutable();
Log.d(this, "setAudioState %s", state);
mAudioState = state;
onAudioStateChanged(state);
@@ -660,10 +832,10 @@ public abstract class Connection implements IConferenceable {
}
/**
- * Returns the connection's {@link PhoneCapabilities}
+ * Returns the connection's capabilities, as a bit mask of the {@code CAPABILITY_*} constants.
*/
- public final int getCallCapabilities() {
- return mCallCapabilities;
+ public final int getConnectionCapabilities() {
+ return mConnectionCapabilities;
}
/**
@@ -674,6 +846,7 @@ public abstract class Connection implements IConferenceable {
* See {@link TelecomManager} for valid values.
*/
public final void setAddress(Uri address, int presentation) {
+ checkImmutable();
Log.d(this, "setAddress %s", address);
mAddress = address;
mAddressPresentation = presentation;
@@ -690,6 +863,7 @@ public abstract class Connection implements IConferenceable {
* See {@link TelecomManager} for valid values.
*/
public final void setCallerDisplayName(String callerDisplayName, int presentation) {
+ checkImmutable();
Log.d(this, "setCallerDisplayName %s", callerDisplayName);
mCallerDisplayName = callerDisplayName;
mCallerDisplayNamePresentation = presentation;
@@ -709,6 +883,7 @@ public abstract class Connection implements IConferenceable {
* @hide
*/
public final void setVideoState(int videoState) {
+ checkImmutable();
Log.d(this, "setVideoState %d", videoState);
mVideoState = videoState;
for (Listener l : mListeners) {
@@ -717,18 +892,20 @@ public abstract class Connection implements IConferenceable {
}
/**
- * Sets state to active (e.g., an ongoing call where two or more parties can actively
+ * Sets state to active (e.g., an ongoing connection where two or more parties can actively
* communicate).
*/
public final void setActive() {
+ checkImmutable();
setRingbackRequested(false);
setState(STATE_ACTIVE);
}
/**
- * Sets state to ringing (e.g., an inbound ringing call).
+ * Sets state to ringing (e.g., an inbound ringing connection).
*/
public final void setRinging() {
+ checkImmutable();
setState(STATE_RINGING);
}
@@ -736,6 +913,7 @@ public abstract class Connection implements IConferenceable {
* Sets state to initializing (this Connection is not yet ready to be used).
*/
public final void setInitializing() {
+ checkImmutable();
setState(STATE_INITIALIZING);
}
@@ -743,13 +921,15 @@ public abstract class Connection implements IConferenceable {
* Sets state to initialized (the Connection has been set up and is now ready to be used).
*/
public final void setInitialized() {
+ checkImmutable();
setState(STATE_NEW);
}
/**
- * Sets state to dialing (e.g., dialing an outbound call).
+ * Sets state to dialing (e.g., dialing an outbound connection).
*/
public final void setDialing() {
+ checkImmutable();
setState(STATE_DIALING);
}
@@ -757,15 +937,17 @@ public abstract class Connection implements IConferenceable {
* Sets state to be on hold.
*/
public final void setOnHold() {
+ checkImmutable();
setState(STATE_HOLDING);
}
/**
- * Sets the video call provider.
+ * Sets the video connection provider.
* @param videoProvider The video provider.
* @hide
*/
public final void setVideoProvider(VideoProvider videoProvider) {
+ checkImmutable();
mVideoProvider = videoProvider;
for (Listener l : mListeners) {
l.onVideoProviderChanged(this, videoProvider);
@@ -784,6 +966,7 @@ public abstract class Connection implements IConferenceable {
* {@link DisconnectCause}.
*/
public final void setDisconnected(DisconnectCause disconnectCause) {
+ checkImmutable();
mDisconnectCause = disconnectCause;
setState(STATE_DISCONNECTED);
Log.d(this, "Disconnected with cause %s", disconnectCause);
@@ -793,9 +976,17 @@ public abstract class Connection implements IConferenceable {
}
/**
- * TODO: Needs documentation.
+ * 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.
+ *
+ * @param remaining The DTMF character sequence remaining to be emitted once the
+ * {@link #onPostDialContinue(boolean)} is received, including any "wait" characters
+ * that remaining sequence may contain.
*/
public final void setPostDialWait(String remaining) {
+ checkImmutable();
for (Listener l : mListeners) {
l.onPostDialWait(this, remaining);
}
@@ -803,11 +994,12 @@ public abstract class Connection implements IConferenceable {
/**
* 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 call's audio stream.
+ * that do not play a ringback tone themselves in the connection's audio stream.
*
* @param ringback Whether the ringback tone is to be played.
*/
public final void setRingbackRequested(boolean ringback) {
+ checkImmutable();
if (mRingbackRequested != ringback) {
mRingbackRequested = ringback;
for (Listener l : mListeners) {
@@ -816,16 +1008,22 @@ public abstract class Connection implements IConferenceable {
}
}
+ /** @hide */
+ @Deprecated public final void setCapabilities(int connectionCapabilities) {
+ setConnectionCapabilities(connectionCapabilities);
+ }
+
/**
- * Sets the connection's {@link PhoneCapabilities}.
+ * Sets the connection's capabilities as a bit mask of the {@code CAPABILITY_*} constants.
*
- * @param callCapabilities The new call capabilities.
+ * @param connectionCapabilities The new connection capabilities.
*/
- public final void setCallCapabilities(int callCapabilities) {
- if (mCallCapabilities != callCapabilities) {
- mCallCapabilities = callCapabilities;
+ public final void setConnectionCapabilities(int connectionCapabilities) {
+ checkImmutable();
+ if (mConnectionCapabilities != connectionCapabilities) {
+ mConnectionCapabilities = connectionCapabilities;
for (Listener l : mListeners) {
- l.onCallCapabilitiesChanged(this, mCallCapabilities);
+ l.onConnectionCapabilitiesChanged(this, mConnectionCapabilities);
}
}
}
@@ -845,6 +1043,7 @@ public abstract class Connection implements IConferenceable {
* @param isVoip True if the audio mode is VOIP.
*/
public final void setAudioModeIsVoip(boolean isVoip) {
+ checkImmutable();
mAudioModeIsVoip = isVoip;
for (Listener l : mListeners) {
l.onAudioModeIsVoipChanged(this, isVoip);
@@ -857,6 +1056,7 @@ public abstract class Connection implements IConferenceable {
* @param statusHints The status label and icon to set.
*/
public final void setStatusHints(StatusHints statusHints) {
+ checkImmutable();
mStatusHints = statusHints;
for (Listener l : mListeners) {
l.onStatusHintsChanged(this, statusHints);
@@ -869,6 +1069,7 @@ public abstract class Connection implements IConferenceable {
* @param conferenceableConnections The set of connections this connection can conference with.
*/
public final void setConferenceableConnections(List
- * 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 A {@code Connection} which indicates that the underlying call should be canceled.
+ * @return A {@code Connection} which indicates that the underlying connection should
+ * be canceled.
*/
public static Connection createCanceledConnection() {
return new FailureSignalingConnection(new DisconnectCause(DisconnectCause.CANCELED));
}
- private final void fireOnConferenceableConnectionsChanged() {
+ private final void fireOnConferenceableConnectionsChanged() {
for (Listener l : mListeners) {
l.onConferenceablesChanged(this, getConferenceables());
}
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index 08f385378450c..d0a8aeeea4a7c 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -407,11 +407,13 @@ public abstract class ConnectionService extends Service {
}
@Override
- public void onCapabilitiesChanged(Conference conference, int capabilities) {
+ public void onConnectionCapabilitiesChanged(
+ Conference conference,
+ int connectionCapabilities) {
String id = mIdByConference.get(conference);
Log.d(this, "call capabilities: conference: %s",
- PhoneCapabilities.toString(capabilities));
- mAdapter.setCallCapabilities(id, capabilities);
+ Connection.capabilitiesToString(connectionCapabilities));
+ mAdapter.setConnectionCapabilities(id, connectionCapabilities);
}
};
@@ -489,11 +491,11 @@ public abstract class ConnectionService extends Service {
}
@Override
- public void onCallCapabilitiesChanged(Connection c, int capabilities) {
+ public void onConnectionCapabilitiesChanged(Connection c, int capabilities) {
String id = mIdByConnection.get(c);
Log.d(this, "capabilities: parcelableconnection: %s",
- PhoneCapabilities.toString(capabilities));
- mAdapter.setCallCapabilities(id, capabilities);
+ Connection.capabilitiesToString(capabilities));
+ mAdapter.setConnectionCapabilities(id, capabilities);
}
@Override
@@ -581,7 +583,7 @@ public abstract class ConnectionService extends Service {
Log.v(this, "createConnection, number: %s, state: %s, capabilities: %s",
Connection.toLogSafePhoneNumber(number),
Connection.stateToString(connection.getState()),
- PhoneCapabilities.toString(connection.getCallCapabilities()));
+ Connection.capabilitiesToString(connection.getConnectionCapabilities()));
Log.d(this, "createConnection, calling handleCreateConnectionSuccessful %s", callId);
mAdapter.handleCreateConnectionComplete(
@@ -590,7 +592,7 @@ public abstract class ConnectionService extends Service {
new ParcelableConnection(
request.getAccountHandle(),
connection.getState(),
- connection.getCallCapabilities(),
+ connection.getConnectionCapabilities(),
connection.getAddress(),
connection.getAddressPresentation(),
connection.getCallerDisplayName(),
@@ -873,7 +875,7 @@ public abstract class ConnectionService extends Service {
ParcelableConference parcelableConference = new ParcelableConference(
conference.getPhoneAccountHandle(),
conference.getState(),
- conference.getCapabilities(),
+ conference.getConnectionCapabilities(),
connectionIds);
mAdapter.addConferenceCall(id, parcelableConference);
@@ -904,7 +906,7 @@ public abstract class ConnectionService extends Service {
ParcelableConnection parcelableConnection = new ParcelableConnection(
phoneAccountHandle,
connection.getState(),
- connection.getCallCapabilities(),
+ connection.getConnectionCapabilities(),
connection.getAddress(),
connection.getAddressPresentation(),
connection.getCallerDisplayName(),
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
index e67af8cf906d8..aee96755a3d9d 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
@@ -175,10 +175,10 @@ final class ConnectionServiceAdapter implements DeathRecipient {
}
}
- void setCallCapabilities(String callId, int capabilities) {
+ void setConnectionCapabilities(String callId, int capabilities) {
for (IConnectionServiceAdapter adapter : mAdapters) {
try {
- adapter.setCallCapabilities(callId, capabilities);
+ adapter.setConnectionCapabilities(callId, capabilities);
} catch (RemoteException ignored) {
}
}
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
index 519a400f6447c..7619da5c34f73 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
@@ -44,7 +44,7 @@ final class ConnectionServiceAdapterServant {
private static final int MSG_SET_DISCONNECTED = 5;
private static final int MSG_SET_ON_HOLD = 6;
private static final int MSG_SET_RINGBACK_REQUESTED = 7;
- private static final int MSG_SET_CALL_CAPABILITIES = 8;
+ private static final int MSG_SET_CONNECTION_CAPABILITIES = 8;
private static final int MSG_SET_IS_CONFERENCED = 9;
private static final int MSG_ADD_CONFERENCE_CALL = 10;
private static final int MSG_REMOVE_CALL = 11;
@@ -109,8 +109,8 @@ final class ConnectionServiceAdapterServant {
case MSG_SET_RINGBACK_REQUESTED:
mDelegate.setRingbackRequested((String) msg.obj, msg.arg1 == 1);
break;
- case MSG_SET_CALL_CAPABILITIES:
- mDelegate.setCallCapabilities((String) msg.obj, msg.arg1);
+ case MSG_SET_CONNECTION_CAPABILITIES:
+ mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1);
break;
case MSG_SET_IS_CONFERENCED: {
SomeArgs args = (SomeArgs) msg.obj;
@@ -263,8 +263,9 @@ final class ConnectionServiceAdapterServant {
}
@Override
- public void setCallCapabilities(String connectionId, int callCapabilities) {
- mHandler.obtainMessage(MSG_SET_CALL_CAPABILITIES, callCapabilities, 0, connectionId)
+ public void setConnectionCapabilities(String connectionId, int connectionCapabilities) {
+ mHandler.obtainMessage(
+ MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, connectionId)
.sendToTarget();
}
diff --git a/telecomm/java/android/telecom/ParcelableConference.java b/telecomm/java/android/telecom/ParcelableConference.java
index 97c709c774e88..c4e11d6b6f597 100644
--- a/telecomm/java/android/telecom/ParcelableConference.java
+++ b/telecomm/java/android/telecom/ParcelableConference.java
@@ -30,17 +30,17 @@ public final class ParcelableConference implements Parcelable {
private PhoneAccountHandle mPhoneAccount;
private int mState;
- private int mCapabilities;
+ private int mConnectionCapabilities;
private List
- * This is only intended for use by a {@link Conference}.
- */
- public static final int MERGE_CONFERENCE = 0x00000004;
-
- /**
- * Calls within a conference can be swapped between foreground and background.
- * See {@link #MERGE_CONFERENCE} for additional information.
- *
- * This is only intended for use by a {@link Conference}.
- */
- public static final int SWAP_CONFERENCE = 0x00000008;
-
- /**
- * @hide
- */
- public static final int UNUSED = 0x00000010;
-
- /** Call supports responding via text option. */
- public static final int RESPOND_VIA_TEXT = 0x00000020;
-
- /** Call can be muted. */
- public static final int MUTE = 0x00000040;
-
- /**
- * Call supports conference call management. This capability only applies to {@link Conference}
- * calls which can have {@link Connection}s as children.
- */
- public static final int MANAGE_CONFERENCE = 0x00000080;
-
- /**
- * Local device supports video telephony.
- * @hide
- */
- public static final int SUPPORTS_VT_LOCAL = 0x00000100;
-
- /**
- * Remote device supports video telephony.
- * @hide
- */
- public static final int SUPPORTS_VT_REMOTE = 0x00000200;
-
- /**
- * Call is using voice over LTE.
- * @hide
- */
- public static final int VoLTE = 0x00000400;
-
- /**
- * Call is using voice over WIFI.
- * @hide
- */
- public static final int VoWIFI = 0x00000800;
-
- /**
- * Call is able to be separated from its parent {@code Conference}, if any.
- */
- public static final int SEPARATE_FROM_CONFERENCE = 0x00001000;
-
- /**
- * Call is able to be individually disconnected when in a {@code Conference}.
- */
- public static final int DISCONNECT_FROM_CONFERENCE = 0x00002000;
-
- /**
- * Whether the call is a generic conference, where we do not know the precise state of
- * participants in the conference (eg. on CDMA).
- *
- * TODO: Move to CallProperties.
- *
- * @hide
- */
- public static final int GENERIC_CONFERENCE = 0x00004000;
-
- public static final int ALL = HOLD | SUPPORT_HOLD | MERGE_CONFERENCE | SWAP_CONFERENCE
- | RESPOND_VIA_TEXT | MUTE | MANAGE_CONFERENCE | SEPARATE_FROM_CONFERENCE
- | DISCONNECT_FROM_CONFERENCE;
-
- /**
- * Whether this set of capabilities supports the specified capability.
- * @param capabilities The set of capabilities.
- * @param capability The capability to check capabilities for.
- * @return Whether the specified capability is supported.
- * @hide
- */
- public static boolean can(int capabilities, int capability) {
- return (capabilities & capability) != 0;
- }
-
- /**
- * Removes the specified capability from the set of capabilities and returns the new set.
- * @param capabilities The set of capabilities.
- * @param capability The capability to remove from the set.
- * @return The set of capabilities, with the capability removed.
- * @hide
- */
- public static int remove(int capabilities, int capability) {
- return capabilities & ~capability;
- }
-
- public static String toString(int capabilities) {
- StringBuilder builder = new StringBuilder();
- builder.append("[Capabilities:");
- if (can(capabilities, HOLD)) {
- builder.append(" HOLD");
- }
- if (can(capabilities, SUPPORT_HOLD)) {
- builder.append(" SUPPORT_HOLD");
- }
- if (can(capabilities, MERGE_CONFERENCE)) {
- builder.append(" MERGE_CONFERENCE");
- }
- if (can(capabilities, SWAP_CONFERENCE)) {
- builder.append(" SWAP_CONFERENCE");
- }
- if (can(capabilities, RESPOND_VIA_TEXT)) {
- builder.append(" RESPOND_VIA_TEXT");
- }
- if (can(capabilities, MUTE)) {
- builder.append(" MUTE");
- }
- if (can(capabilities, MANAGE_CONFERENCE)) {
- builder.append(" MANAGE_CONFERENCE");
- }
- if (can(capabilities, SUPPORTS_VT_LOCAL)) {
- builder.append(" SUPPORTS_VT_LOCAL");
- }
- if (can(capabilities, SUPPORTS_VT_REMOTE)) {
- builder.append(" SUPPORTS_VT_REMOTE");
- }
- if (can(capabilities, VoLTE)) {
- builder.append(" VoLTE");
- }
- if (can(capabilities, VoWIFI)) {
- builder.append(" VoWIFI");
- }
- if (can(capabilities, GENERIC_CONFERENCE)) {
- builder.append(" GENERIC_CONFERENCE");
- }
-
- builder.append("]");
- return builder.toString();
- }
-
- private PhoneCapabilities() {}
-}
diff --git a/telecomm/java/android/telecom/RemoteConference.java b/telecomm/java/android/telecom/RemoteConference.java
index b548274de2fcd..a8879ae8aff45 100644
--- a/telecomm/java/android/telecom/RemoteConference.java
+++ b/telecomm/java/android/telecom/RemoteConference.java
@@ -40,7 +40,9 @@ public final class RemoteConference {
public void onDisconnected(RemoteConference conference, DisconnectCause disconnectCause) {}
public void onConnectionAdded(RemoteConference conference, RemoteConnection connection) {}
public void onConnectionRemoved(RemoteConference conference, RemoteConnection connection) {}
- public void onCapabilitiesChanged(RemoteConference conference, int capabilities) {}
+ public void onConnectionCapabilitiesChanged(
+ RemoteConference conference,
+ int connectionCapabilities) {}
public void onConferenceableConnectionsChanged(
RemoteConference conference,
List