summaryrefslogtreecommitdiffstats
path: root/telecomm
diff options
context:
space:
mode:
authorIhab Awad <ihab@google.com>2014-11-12 13:41:16 -0800
committerIhab Awad <ihab@google.com>2014-11-28 15:54:35 -0800
commit5c9c86ec0f95d1f5e1aca212967f508fc736b895 (patch)
tree1706be6ac513145c4d0eab52649319509bd99d1e /telecomm
parent07b4a291319ec48a272451789ab0fbbf8d55a050 (diff)
downloadframeworks_base-5c9c86ec0f95d1f5e1aca212967f508fc736b895.zip
frameworks_base-5c9c86ec0f95d1f5e1aca212967f508fc736b895.tar.gz
frameworks_base-5c9c86ec0f95d1f5e1aca212967f508fc736b895.tar.bz2
Telecom API updates (1/6)
Bug: 18292176 Change-Id: I060366234a5a60510c385dc837f2b7e79596eaf5
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecom/AudioState.java51
-rw-r--r--telecomm/java/android/telecom/Call.java165
-rw-r--r--telecomm/java/android/telecom/Conference.java84
-rw-r--r--telecomm/java/android/telecom/Connection.java295
-rw-r--r--telecomm/java/android/telecom/ConnectionService.java22
-rw-r--r--telecomm/java/android/telecom/ConnectionServiceAdapter.java4
-rw-r--r--telecomm/java/android/telecom/ConnectionServiceAdapterServant.java11
-rw-r--r--telecomm/java/android/telecom/ParcelableConference.java14
-rw-r--r--telecomm/java/android/telecom/ParcelableConnection.java12
-rw-r--r--telecomm/java/android/telecom/PhoneAccount.java19
-rw-r--r--telecomm/java/android/telecom/PhoneCapabilities.java185
-rw-r--r--telecomm/java/android/telecom/RemoteConference.java23
-rw-r--r--telecomm/java/android/telecom/RemoteConnection.java74
-rw-r--r--telecomm/java/android/telecom/RemoteConnectionService.java14
-rw-r--r--telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl2
15 files changed, 644 insertions, 331 deletions
diff --git a/telecomm/java/android/telecom/AudioState.java b/telecomm/java/android/telecom/AudioState.java
index f78ce29..bd63e00 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 354fa2e..7df40f1 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.
+ * <p>
+ * 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.
+ * <p>
+ * 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;
@@ -112,6 +197,78 @@ public final class Call {
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 6e404de..5371481 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<Connection> conferenceableConnections) {}
public void onDestroyed(Conference conference) {}
- public void onCapabilitiesChanged(Conference conference, int capabilities) {}
+ public void onConnectionCapabilitiesChanged(
+ Conference conference, int connectionCapabilities) {}
}
private final Set<Listener> mListeners = new CopyOnWriteArraySet<>();
@@ -56,7 +57,7 @@ public abstract class Conference implements IConferenceable {
private AudioState mAudioState;
private int mState = Connection.STATE_NEW;
private DisconnectCause mDisconnectCause;
- private int mCapabilities;
+ private int mConnectionCapabilities;
private String mDisconnectMessage;
private final Connection.Listener mConnectionDeathListener = new Connection.Listener() {
@@ -104,13 +105,62 @@ public abstract class Conference implements IConferenceable {
return mState;
}
+ /** @hide */
+ @Deprecated public final int getCapabilities() {
+ return getConnectionCapabilities();
+ }
+
+ /**
+ * Returns the capabilities of a conference. See {@code CAPABILITY_*} constants in class
+ * {@link Connection} for valid values.
+ *
+ * @return A bitmask of the capabilities of the conference call.
+ */
+ public final int getConnectionCapabilities() {
+ return mConnectionCapabilities;
+ }
+
+ /**
+ * 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);
+ }
+
/**
- * Returns the capabilities of a conference. See {@link PhoneCapabilities} for valid values.
+ * Removes the specified capability from the set of capabilities of this {@code Conference}.
*
- * @return A bitmask of the {@code PhoneCapabilities} of the conference call.
+ * @param capability The capability to remove from the set.
+ * @hide
*/
- public final int getCapabilities() {
- return mCapabilities;
+ public void removeCapability(int capability) {
+ mConnectionCapabilities &= ~capability;
+ }
+
+ /**
+ * Adds the specified capability to the set of capabilities of this {@code Conference}.
+ *
+ * @param capability The capability to add to the set.
+ * @hide
+ */
+ public void addCapability(int capability) {
+ mConnectionCapabilities |= capability;
}
/**
@@ -153,13 +203,13 @@ public abstract class Conference implements IConferenceable {
/**
* Invoked when the child calls should be merged. Only invoked if the conference contains the
- * capability {@link PhoneCapabilities#MERGE_CONFERENCE}.
+ * capability {@link Connection#CAPABILITY_MERGE_CONFERENCE}.
*/
public void onMerge() {}
/**
* Invoked when the child calls should be swapped. Only invoked if the conference contains the
- * capability {@link PhoneCapabilities#SWAP_CONFERENCE}.
+ * capability {@link Connection#CAPABILITY_SWAP_CONFERENCE}.
*/
public void onSwap() {}
@@ -224,17 +274,23 @@ public abstract class Conference implements IConferenceable {
return mDisconnectCause;
}
+ /** @hide */
+ @Deprecated public final void setCapabilities(int connectionCapabilities) {
+ setConnectionCapabilities(connectionCapabilities);
+ }
+
/**
- * Sets the capabilities of a conference. See {@link PhoneCapabilities} for valid values.
+ * Sets the capabilities of a conference. See {@code CAPABILITY_*} constants of class
+ * {@link Connection} for valid values.
*
- * @param capabilities A bitmask of the {@code PhoneCapabilities} of the conference call.
+ * @param connectionCapabilities A bitmask of the {@code PhoneCapabilities} of the conference call.
*/
- public final void setCapabilities(int capabilities) {
- if (capabilities != mCapabilities) {
- mCapabilities = capabilities;
+ public final void setConnectionCapabilities(int connectionCapabilities) {
+ if (connectionCapabilities != mConnectionCapabilities) {
+ mConnectionCapabilities = connectionCapabilities;
for (Listener l : mListeners) {
- l.onCapabilitiesChanged(this, mCapabilities);
+ l.onConnectionCapabilitiesChanged(this, mConnectionCapabilities);
}
}
}
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index fb63c85..125ada0 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -63,9 +63,180 @@ public abstract class Connection implements IConferenceable {
public static final int STATE_DISCONNECTED = 6;
+ /** Connection can currently be put on hold or unheld. */
+ public static final int CAPABILITY_HOLD = 0x00000001;
+
+ /** Connection supports the hold feature. */
+ public static final int CAPABILITY_SUPPORT_HOLD = 0x00000002;
+
+ /**
+ * Connections within a conference can be merged. A {@link ConnectionService} has the option to
+ * add a {@link Conference} 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 is in the foreground
+ * of the in-call UI.
+ * <p>
+ * 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.
+ * <p>
+ * 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<Connection> conferenceableConnections) {
+ checkImmutable();
clearConferenceableList();
for (Connection c : conferenceableConnections) {
// If statement checks for duplicates in input. It makes it N^2 but we're dealing with a
@@ -917,6 +1118,7 @@ public abstract class Connection implements IConferenceable {
* @hide
*/
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.");
@@ -946,13 +1148,14 @@ public abstract class Connection implements IConferenceable {
/**
* Sets the conference that this connection is a part of. This will fail if the connection is
- * already part of a conference call. {@link #resetConference} to un-set the conference first.
+ * already part of a conference. {@link #resetConference} to un-set the conference first.
*
* @param conference The conference.
* @return {@code true} if the conference was successfully set.
* @hide
*/
public final boolean setConference(Conference conference) {
+ checkImmutable();
// We check to see if it is already part of another conference.
if (mConference == null) {
mConference = conference;
@@ -979,7 +1182,7 @@ public abstract class Connection implements IConferenceable {
/**
* Notifies this Connection that the {@link #getAudioState()} property has a new value.
*
- * @param state The new call audio state.
+ * @param state The new connection audio state.
*/
public void onAudioStateChanged(AudioState state) {}
@@ -1041,7 +1244,7 @@ public abstract class Connection implements IConferenceable {
* Notifies this Connection, which is in {@link #STATE_RINGING}, of
* a request to accept.
*
- * @param videoState The video state in which to answer the call.
+ * @param videoState The video state in which to answer the connection.
* @hide
*/
public void onAnswer(int videoState) {}
@@ -1091,6 +1294,7 @@ public abstract class Connection implements IConferenceable {
}
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;
@@ -1109,6 +1313,10 @@ public abstract class Connection implements IConferenceable {
public FailureSignalingConnection(DisconnectCause disconnectCause) {
setDisconnected(disconnectCause);
}
+
+ public void checkImmutable() {
+ throw new UnsupportedOperationException("Connection is immutable");
+ }
}
/**
@@ -1127,21 +1335,30 @@ public abstract class Connection implements IConferenceable {
}
/**
+ * 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.
+ *
+ * @hide
+ */
+ public void checkImmutable() {}
+
+ /**
* 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.
* <p>
- * 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 08f3853..d0a8aee 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 e67af8c..aee9675 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 519a400..7619da5 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 97c709c..c4e11d6 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<String> mConnectionIds;
public ParcelableConference(
PhoneAccountHandle phoneAccount,
int state,
- int capabilities,
+ int connectionCapabilities,
List<String> connectionIds) {
mPhoneAccount = phoneAccount;
mState = state;
- mCapabilities = capabilities;
+ mConnectionCapabilities = connectionCapabilities;
mConnectionIds = connectionIds;
}
@@ -52,7 +52,7 @@ public final class ParcelableConference implements Parcelable {
.append(", state: ")
.append(Connection.stateToString(mState))
.append(", capabilities: ")
- .append(PhoneCapabilities.toString(mCapabilities))
+ .append(Connection.capabilitiesToString(mConnectionCapabilities))
.append(", children: ")
.append(mConnectionIds)
.toString();
@@ -66,8 +66,8 @@ public final class ParcelableConference implements Parcelable {
return mState;
}
- public int getCapabilities() {
- return mCapabilities;
+ public int getConnectionCapabilities() {
+ return mConnectionCapabilities;
}
public List<String> getConnectionIds() {
@@ -105,7 +105,7 @@ public final class ParcelableConference implements Parcelable {
public void writeToParcel(Parcel destination, int flags) {
destination.writeParcelable(mPhoneAccount, 0);
destination.writeInt(mState);
- destination.writeInt(mCapabilities);
+ destination.writeInt(mConnectionCapabilities);
destination.writeList(mConnectionIds);
}
}
diff --git a/telecomm/java/android/telecom/ParcelableConnection.java b/telecomm/java/android/telecom/ParcelableConnection.java
index 9004448..552e250 100644
--- a/telecomm/java/android/telecom/ParcelableConnection.java
+++ b/telecomm/java/android/telecom/ParcelableConnection.java
@@ -34,7 +34,7 @@ import java.util.List;
public final class ParcelableConnection implements Parcelable {
private final PhoneAccountHandle mPhoneAccount;
private final int mState;
- private final int mCapabilities;
+ private final int mConnectionCapabilities;
private final Uri mAddress;
private final int mAddressPresentation;
private final String mCallerDisplayName;
@@ -65,7 +65,7 @@ public final class ParcelableConnection implements Parcelable {
List<String> conferenceableConnectionIds) {
mPhoneAccount = phoneAccount;
mState = state;
- mCapabilities = capabilities;
+ mConnectionCapabilities = capabilities;
mAddress = address;
mAddressPresentation = addressPresentation;
mCallerDisplayName = callerDisplayName;
@@ -88,8 +88,8 @@ public final class ParcelableConnection implements Parcelable {
}
// Bit mask of actions a call supports, values are defined in {@link CallCapabilities}.
- public int getCapabilities() {
- return mCapabilities;
+ public int getConnectionCapabilities() {
+ return mConnectionCapabilities;
}
public Uri getHandle() {
@@ -144,7 +144,7 @@ public final class ParcelableConnection implements Parcelable {
.append(", state:")
.append(mState)
.append(", capabilities:")
- .append(PhoneCapabilities.toString(mCapabilities))
+ .append(Connection.capabilitiesToString(mConnectionCapabilities))
.toString();
}
@@ -205,7 +205,7 @@ public final class ParcelableConnection implements Parcelable {
public void writeToParcel(Parcel destination, int flags) {
destination.writeParcelable(mPhoneAccount, 0);
destination.writeInt(mState);
- destination.writeInt(mCapabilities);
+ destination.writeInt(mConnectionCapabilities);
destination.writeParcelable(mAddress, 0);
destination.writeInt(mAddressPresentation);
destination.writeString(mCallerDisplayName);
diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java
index 2240c44..6bd6a2f 100644
--- a/telecomm/java/android/telecom/PhoneAccount.java
+++ b/telecomm/java/android/telecom/PhoneAccount.java
@@ -120,9 +120,14 @@ public class PhoneAccount implements Parcelable {
public static final String SCHEME_SIP = "sip";
/**
- * Indicating no color is set.
+ * Indicating no icon tint is set.
*/
- public static final int NO_COLOR = -1;
+ public static final int NO_ICON_TINT = 0;
+
+ /**
+ * Indicating no hightlight color is set.
+ */
+ public static final int NO_HIGHLIGHT_COLOR = 0;
/**
* Indicating no resource ID is set.
@@ -153,8 +158,8 @@ public class PhoneAccount implements Parcelable {
private int mIconResId;
private String mIconPackageName;
private Bitmap mIconBitmap;
- private int mIconTint = NO_COLOR;
- private int mHighlightColor = NO_COLOR;
+ private int mIconTint = NO_ICON_TINT;
+ private int mHighlightColor = NO_HIGHLIGHT_COLOR;
private CharSequence mLabel;
private CharSequence mShortDescription;
private List<String> mSupportedUriSchemes = new ArrayList<String>();
@@ -240,7 +245,7 @@ public class PhoneAccount implements Parcelable {
* @return The builder.
*/
public Builder setIcon(String iconPackageName, int iconResId) {
- return setIcon(iconPackageName, iconResId, NO_COLOR);
+ return setIcon(iconPackageName, iconResId, NO_ICON_TINT);
}
/**
@@ -280,7 +285,7 @@ public class PhoneAccount implements Parcelable {
this.mIconBitmap = iconBitmap;
this.mIconPackageName = null;
this.mIconResId = NO_RESOURCE_ID;
- this.mIconTint = NO_COLOR;
+ this.mIconTint = NO_ICON_TINT;
return this;
}
@@ -589,7 +594,7 @@ public class PhoneAccount implements Parcelable {
Context packageContext = context.createPackageContext(mIconPackageName, 0);
try {
Drawable iconDrawable = packageContext.getDrawable(mIconResId);
- if (mIconTint != NO_COLOR) {
+ if (mIconTint != NO_ICON_TINT) {
iconDrawable.setTint(mIconTint);
}
return iconDrawable;
diff --git a/telecomm/java/android/telecom/PhoneCapabilities.java b/telecomm/java/android/telecom/PhoneCapabilities.java
deleted file mode 100644
index c21a6d1..0000000
--- a/telecomm/java/android/telecom/PhoneCapabilities.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright 2014, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.telecom;
-
-import android.annotation.SystemApi;
-
-/**
- * Defines capabilities for {@link Connection}s and {@link Conference}s such as hold, swap, and
- * merge.
- * @hide
- */
-@SystemApi
-public final class PhoneCapabilities {
- /** Call can currently be put on hold or unheld. */
- public static final int HOLD = 0x00000001;
-
- /** Call supports the hold feature. */
- public static final int 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.
- * <p>
- * 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.
- * <p>
- * 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 b548274..a8879ae 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<RemoteConnection> conferenceableConnections) {}
@@ -60,7 +62,7 @@ public final class RemoteConference {
private int mState = Connection.STATE_NEW;
private DisconnectCause mDisconnectCause;
- private int mCallCapabilities;
+ private int mConnectionCapabilities;
/** {@hide} */
RemoteConference(String id, IConnectionService connectionService) {
@@ -125,11 +127,11 @@ public final class RemoteConference {
}
/** {@hide} */
- void setCallCapabilities(int capabilities) {
- if (mCallCapabilities != capabilities) {
- mCallCapabilities = capabilities;
+ void setConnectionCapabilities(int connectionCapabilities) {
+ if (mConnectionCapabilities != connectionCapabilities) {
+ mConnectionCapabilities = connectionCapabilities;
for (Callback c : mCallbacks) {
- c.onCapabilitiesChanged(this, mCallCapabilities);
+ c.onConnectionCapabilitiesChanged(this, mConnectionCapabilities);
}
}
}
@@ -162,8 +164,13 @@ public final class RemoteConference {
return mState;
}
- public final int getCallCapabilities() {
- return mCallCapabilities;
+ /** @hide */
+ @Deprecated public final int getCallCapabilities() {
+ return getConnectionCapabilities();
+ }
+
+ public final int getConnectionCapabilities() {
+ return mConnectionCapabilities;
}
public void disconnect() {
diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java
index d70ddf6..95cc387 100644
--- a/telecomm/java/android/telecom/RemoteConnection.java
+++ b/telecomm/java/android/telecom/RemoteConnection.java
@@ -73,14 +73,21 @@ public final class RemoteConnection {
*/
public void onRingbackRequested(RemoteConnection connection, boolean ringback) {}
+ /** @hide */
+ @Deprecated public void onCallCapabilitiesChanged(
+ RemoteConnection connection,
+ int callCapabilities) {}
+
/**
* Indicates that the call capabilities of this {@code RemoteConnection} have changed.
- * See {@link #getCallCapabilities()}.
+ * See {@link #getConnectionCapabilities()}.
*
* @param connection The {@code RemoteConnection} invoking this method.
- * @param callCapabilities The new call capabilities of the {@code RemoteConnection}.
+ * @param connectionCapabilities The new capabilities of the {@code RemoteConnection}.
*/
- public void onCallCapabilitiesChanged(RemoteConnection connection, int callCapabilities) {}
+ public void onConnectionCapabilitiesChanged(
+ RemoteConnection connection,
+ int connectionCapabilities) {}
/**
* Invoked when the post-dial sequence in the outgoing {@code Connection} has reached a
@@ -385,7 +392,7 @@ public final class RemoteConnection {
private DisconnectCause mDisconnectCause;
private boolean mRingbackRequested;
private boolean mConnected;
- private int mCallCapabilities;
+ private int mConnectionCapabilities;
private int mVideoState;
private VideoProvider mVideoProvider;
private boolean mIsVoipAudioMode;
@@ -420,7 +427,7 @@ public final class RemoteConnection {
mState = connection.getState();
mDisconnectCause = connection.getDisconnectCause();
mRingbackRequested = connection.isRingbackRequested();
- mCallCapabilities = connection.getCapabilities();
+ mConnectionCapabilities = connection.getConnectionCapabilities();
mVideoState = connection.getVideoState();
mVideoProvider = new RemoteConnection.VideoProvider(connection.getVideoProvider());
mIsVoipAudioMode = connection.getIsVoipAudioMode();
@@ -477,23 +484,29 @@ public final class RemoteConnection {
}
/**
+ * Obtains the reason why this {@code RemoteConnection} may have been disconnected.
+ *
* @return For a {@link Connection#STATE_DISCONNECTED} {@code RemoteConnection}, the
- * disconnect cause expressed as a code chosen from among those declared in
- * {@link DisconnectCause}.
+ * disconnect cause expressed as a code chosen from among those declared in
+ * {@link DisconnectCause}.
*/
public DisconnectCause getDisconnectCause() {
return mDisconnectCause;
}
/**
+ * Obtains the capabilities of this {@code RemoteConnection}.
+ *
* @return A bitmask of the capabilities of the {@code RemoteConnection}, as defined in
- * {@link PhoneCapabilities}.
+ * the {@code CAPABILITY_*} constants in class {@link Connection}.
*/
- public int getCallCapabilities() {
- return mCallCapabilities;
+ public int getConnectionCapabilities() {
+ return mConnectionCapabilities;
}
/**
+ * Determines if the audio mode of this {@code RemoteConnection} is VOIP.
+ *
* @return {@code true} if the {@code RemoteConnection}'s current audio mode is VOIP.
*/
public boolean isVoipAudioMode() {
@@ -501,30 +514,38 @@ public final class RemoteConnection {
}
/**
+ * Obtains status hints pertaining to this {@code RemoteConnection}.
+ *
* @return The current {@link StatusHints} of this {@code RemoteConnection},
- * or {@code null} if none have been set.
+ * or {@code null} if none have been set.
*/
public StatusHints getStatusHints() {
return mStatusHints;
}
/**
- * @return The address (e.g., phone number) to which the {@code RemoteConnection} is currently
- * connected.
+ * Obtains the address of this {@code RemoteConnection}.
+ *
+ * @return The address (e.g., phone number) to which the {@code RemoteConnection}
+ * is currently connected.
*/
public Uri getAddress() {
return mAddress;
}
/**
- * @return The presentation requirements for the address. See {@link TelecomManager} for valid
- * values.
+ * Obtains the presentation requirements for the address of this {@code RemoteConnection}.
+ *
+ * @return The presentation requirements for the address. See
+ * {@link TelecomManager} for valid values.
*/
public int getAddressPresentation() {
return mAddressPresentation;
}
/**
+ * Obtains the display name for this {@code RemoteConnection}'s caller.
+ *
* @return The display name for the caller.
*/
public CharSequence getCallerDisplayName() {
@@ -532,16 +553,20 @@ public final class RemoteConnection {
}
/**
+ * Obtains the presentation requirements for this {@code RemoteConnection}'s
+ * caller's display name.
+ *
* @return The presentation requirements for the caller display name. See
- * {@link TelecomManager} for valid values.
+ * {@link TelecomManager} for valid values.
*/
public int getCallerDisplayNamePresentation() {
return mCallerDisplayNamePresentation;
}
/**
- * @return The video state of the {@code RemoteConnection}. See
- * {@link VideoProfile.VideoState}.
+ * Obtains the video state of this {@code RemoteConnection}.
+ *
+ * @return The video state of the {@code RemoteConnection}. See {@link VideoProfile.VideoState}.
* @hide
*/
public int getVideoState() {
@@ -549,6 +574,8 @@ public final class RemoteConnection {
}
/**
+ * Obtains the video provider of this {@code RemoteConnection}.
+ *
* @return The video provider associated with this {@code RemoteConnection}.
* @hide
*/
@@ -557,8 +584,10 @@ public final class RemoteConnection {
}
/**
+ * Determines whether this {@code RemoteConnection} is requesting ringback.
+ *
* @return Whether the {@code RemoteConnection} is requesting that the framework play a
- * ringback tone on its behalf.
+ * ringback tone on its behalf.
*/
public boolean isRingbackRequested() {
return false;
@@ -800,10 +829,11 @@ public final class RemoteConnection {
/**
* @hide
*/
- void setCallCapabilities(int callCapabilities) {
- mCallCapabilities = callCapabilities;
+ void setConnectionCapabilities(int connectionCapabilities) {
+ mConnectionCapabilities = connectionCapabilities;
for (Callback c : mCallbacks) {
- c.onCallCapabilitiesChanged(this, callCapabilities);
+ c.onConnectionCapabilitiesChanged(this, connectionCapabilities);
+ c.onCallCapabilitiesChanged(this, connectionCapabilities);
}
}
diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java
index 4bb78c0..906ecaa 100644
--- a/telecomm/java/android/telecom/RemoteConnectionService.java
+++ b/telecomm/java/android/telecom/RemoteConnectionService.java
@@ -59,7 +59,7 @@ final class RemoteConnectionService {
if (connection != NULL_CONNECTION && mPendingConnections.contains(connection)) {
mPendingConnections.remove(connection);
// Unconditionally initialize the connection ...
- connection.setCallCapabilities(parcel.getCapabilities());
+ connection.setConnectionCapabilities(parcel.getConnectionCapabilities());
connection.setAddress(
parcel.getHandle(), parcel.getHandlePresentation());
connection.setCallerDisplayName(
@@ -139,13 +139,13 @@ final class RemoteConnectionService {
}
@Override
- public void setCallCapabilities(String callId, int callCapabilities) {
+ public void setConnectionCapabilities(String callId, int connectionCapabilities) {
if (mConnectionById.containsKey(callId)) {
- findConnectionForAction(callId, "setCallCapabilities")
- .setCallCapabilities(callCapabilities);
+ findConnectionForAction(callId, "setConnectionCapabilities")
+ .setConnectionCapabilities(connectionCapabilities);
} else {
- findConferenceForAction(callId, "setCallCapabilities")
- .setCallCapabilities(callCapabilities);
+ findConferenceForAction(callId, "setConnectionCapabilities")
+ .setConnectionCapabilities(connectionCapabilities);
}
}
@@ -192,7 +192,7 @@ final class RemoteConnectionService {
}
conference.setState(parcel.getState());
- conference.setCallCapabilities(parcel.getCapabilities());
+ conference.setConnectionCapabilities(parcel.getConnectionCapabilities());
mConferenceById.put(callId, conference);
conference.registerCallback(new RemoteConference.Callback() {
@Override
diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
index 0d6b3d9..4517a96 100644
--- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
@@ -52,7 +52,7 @@ oneway interface IConnectionServiceAdapter {
void setRingbackRequested(String callId, boolean ringing);
- void setCallCapabilities(String callId, int callCapabilities);
+ void setConnectionCapabilities(String callId, int connectionCapabilities);
void setIsConferenced(String callId, String conferenceCallId);