summaryrefslogtreecommitdiffstats
path: root/telecomm/java
diff options
context:
space:
mode:
Diffstat (limited to 'telecomm/java')
-rw-r--r--telecomm/java/android/telecom/Call.java23
-rw-r--r--telecomm/java/android/telecom/Conference.java34
-rw-r--r--telecomm/java/android/telecom/Connection.java269
-rw-r--r--telecomm/java/android/telecom/ConnectionRequest.java2
-rw-r--r--telecomm/java/android/telecom/ConnectionService.java24
-rw-r--r--telecomm/java/android/telecom/ConnectionServiceAdapter.java25
-rw-r--r--telecomm/java/android/telecom/ConnectionServiceAdapterServant.java18
-rw-r--r--telecomm/java/android/telecom/DefaultDialerManager.java17
-rw-r--r--telecomm/java/android/telecom/InCallService.java190
-rw-r--r--telecomm/java/android/telecom/ParcelableCall.java21
-rw-r--r--telecomm/java/android/telecom/ParcelableConference.java14
-rw-r--r--telecomm/java/android/telecom/ParcelableConnection.java21
-rw-r--r--telecomm/java/android/telecom/RemoteConference.java28
-rw-r--r--telecomm/java/android/telecom/RemoteConnection.java86
-rw-r--r--telecomm/java/android/telecom/RemoteConnectionService.java12
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java39
-rw-r--r--telecomm/java/android/telecom/VideoProfile.java214
-rw-r--r--telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl3
-rw-r--r--telecomm/java/com/android/internal/telecom/ITelecomService.aidl7
19 files changed, 712 insertions, 335 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index d74c61c..a2e0706 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -253,6 +253,7 @@ public final class Call {
private final int mVideoState;
private final StatusHints mStatusHints;
private final Bundle mExtras;
+ private final Bundle mIntentExtras;
/**
* Whether the supplied capabilities supports the specified capability.
@@ -480,12 +481,19 @@ public final class Call {
}
/**
- * @return A bundle extras to pass with the call
+ * @return The extras associated with this call.
*/
public Bundle getExtras() {
return mExtras;
}
+ /**
+ * @return The extras used with the original intent to place this call.
+ */
+ public Bundle getIntentExtras() {
+ return mIntentExtras;
+ }
+
@Override
public boolean equals(Object o) {
if (o instanceof Details) {
@@ -504,7 +512,8 @@ public final class Call {
Objects.equals(mGatewayInfo, d.mGatewayInfo) &&
Objects.equals(mVideoState, d.mVideoState) &&
Objects.equals(mStatusHints, d.mStatusHints) &&
- Objects.equals(mExtras, d.mExtras);
+ Objects.equals(mExtras, d.mExtras) &&
+ Objects.equals(mIntentExtras, d.mIntentExtras);
}
return false;
}
@@ -524,7 +533,8 @@ public final class Call {
Objects.hashCode(mGatewayInfo) +
Objects.hashCode(mVideoState) +
Objects.hashCode(mStatusHints) +
- Objects.hashCode(mExtras);
+ Objects.hashCode(mExtras) +
+ Objects.hashCode(mIntentExtras);
}
/** {@hide} */
@@ -541,7 +551,8 @@ public final class Call {
GatewayInfo gatewayInfo,
int videoState,
StatusHints statusHints,
- Bundle extras) {
+ Bundle extras,
+ Bundle intentExtras) {
mHandle = handle;
mHandlePresentation = handlePresentation;
mCallerDisplayName = callerDisplayName;
@@ -555,6 +566,7 @@ public final class Call {
mVideoState = videoState;
mStatusHints = statusHints;
mExtras = extras;
+ mIntentExtras = intentExtras;
}
}
@@ -986,7 +998,8 @@ public final class Call {
parcelableCall.getGatewayInfo(),
parcelableCall.getVideoState(),
parcelableCall.getStatusHints(),
- parcelableCall.getExtras());
+ parcelableCall.getExtras(),
+ parcelableCall.getIntentExtras());
boolean detailsChanged = !Objects.equals(mDetails, details);
if (detailsChanged) {
mDetails = details;
diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java
index dfbb67a..77fdb65 100644
--- a/telecomm/java/android/telecom/Conference.java
+++ b/telecomm/java/android/telecom/Conference.java
@@ -16,7 +16,9 @@
package android.telecom;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
+import android.os.Bundle;
import android.telecom.Connection.VideoProvider;
import java.util.ArrayList;
@@ -52,6 +54,7 @@ public abstract class Conference extends Conferenceable {
public void onVideoStateChanged(Conference c, int videoState) { }
public void onVideoProviderChanged(Conference c, Connection.VideoProvider videoProvider) {}
public void onStatusHintsChanged(Conference conference, StatusHints statusHints) {}
+ public void onExtrasChanged(Conference conference, Bundle extras) {}
}
private final Set<Listener> mListeners = new CopyOnWriteArraySet<>();
@@ -70,6 +73,7 @@ public abstract class Conference extends Conferenceable {
private String mDisconnectMessage;
private long mConnectTimeMillis = CONNECT_TIME_NOT_SPECIFIED;
private StatusHints mStatusHints;
+ private Bundle mExtras;
private final Connection.Listener mConnectionDeathListener = new Connection.Listener() {
@Override
@@ -202,7 +206,7 @@ public abstract class Conference extends Conferenceable {
* Returns video state of the primary call.
*/
public int getVideoState() {
- return VideoProfile.VideoState.AUDIO_ONLY;
+ return VideoProfile.STATE_AUDIO_ONLY;
}
/**
@@ -291,6 +295,13 @@ public abstract class Conference extends Conferenceable {
}
/**
+ * Sets state to be dialing.
+ */
+ public final void setDialing() {
+ setState(Connection.STATE_DIALING);
+ }
+
+ /**
* Sets state to be active.
*/
public final void setActive() {
@@ -600,4 +611,25 @@ public abstract class Conference extends Conferenceable {
public final StatusHints getStatusHints() {
return mStatusHints;
}
+
+ /**
+ * Set some extras that can be associated with this {@code Conference}. No assumptions should
+ * be made as to how an In-Call UI or service will handle these extras.
+ * Keys should be fully qualified (e.g., com.example.MY_EXTRA) to avoid conflicts.
+ *
+ * @param extras The extras associated with this {@code Connection}.
+ */
+ public final void setExtras(@Nullable Bundle extras) {
+ mExtras = extras;
+ for (Listener l : mListeners) {
+ l.onExtrasChanged(this, extras);
+ }
+ }
+
+ /**
+ * @return The extras associated with this conference.
+ */
+ public final Bundle getExtras() {
+ return mExtras;
+ }
}
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index fba4e6a..bb210f1 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -20,8 +20,11 @@ import com.android.internal.os.SomeArgs;
import com.android.internal.telecom.IVideoCallback;
import com.android.internal.telecom.IVideoProvider;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
+import android.hardware.camera2.CameraManager;
import android.net.Uri;
+import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
@@ -334,67 +337,95 @@ public abstract class Connection extends Conferenceable {
List<ConferenceParticipant> participants) {}
public void onConferenceStarted() {}
public void onConferenceMergeFailed(Connection c) {}
+ public void onExtrasChanged(Connection c, Bundle extras) {}
}
+ /**
+ * Provides a means of controlling the video session associated with a {@link Connection}.
+ * <p>
+ * Implementations create a custom subclass of {@link VideoProvider} and the
+ * {@link ConnectionService} creates an instance sets it on the {@link Connection} using
+ * {@link Connection#setVideoProvider(VideoProvider)}. Any connection which supports video
+ * should set the {@link VideoProvider}.
+ * <p>
+ * The {@link VideoProvider} serves two primary purposes: it provides a means for Telecom and
+ * {@link InCallService} implementations to issue requests related to the video session;
+ * it provides a means for the {@link ConnectionService} to report events and information
+ * related to the video session to Telecom and the {@link InCallService} implementations.
+ * <p>
+ * {@link InCallService} implementations interact with the {@link VideoProvider} via
+ * {@link android.telecom.InCallService.VideoCall}.
+ */
public static abstract class VideoProvider {
/**
* Video is not being received (no protocol pause was issued).
+ * @see #handleCallSessionEvent(int)
*/
public static final int SESSION_EVENT_RX_PAUSE = 1;
/**
- * Video reception has resumed after a SESSION_EVENT_RX_PAUSE.
+ * Video reception has resumed after a {@link #SESSION_EVENT_RX_PAUSE}.
+ * @see #handleCallSessionEvent(int)
*/
public static final int SESSION_EVENT_RX_RESUME = 2;
/**
* Video transmission has begun. This occurs after a negotiated start of video transmission
* when the underlying protocol has actually begun transmitting video to the remote party.
+ * @see #handleCallSessionEvent(int)
*/
public static final int SESSION_EVENT_TX_START = 3;
/**
* Video transmission has stopped. This occurs after a negotiated stop of video transmission
* when the underlying protocol has actually stopped transmitting video to the remote party.
+ * @see #handleCallSessionEvent(int)
*/
public static final int SESSION_EVENT_TX_STOP = 4;
/**
- * A camera failure has occurred for the selected camera. The In-Call UI can use this as a
- * cue to inform the user the camera is not available.
+ * A camera failure has occurred for the selected camera. The {@link InCallService} can use
+ * this as a cue to inform the user the camera is not available.
+ * @see #handleCallSessionEvent(int)
*/
public static final int SESSION_EVENT_CAMERA_FAILURE = 5;
/**
- * Issued after {@code SESSION_EVENT_CAMERA_FAILURE} when the camera is once again ready for
- * operation. The In-Call UI can use this as a cue to inform the user that the camera has
- * become available again.
+ * Issued after {@link #SESSION_EVENT_CAMERA_FAILURE} when the camera is once again ready
+ * for operation. The {@link InCallService} can use this as a cue to inform the user that
+ * the camera has become available again.
+ * @see #handleCallSessionEvent(int)
*/
public static final int SESSION_EVENT_CAMERA_READY = 6;
/**
* Session modify request was successful.
+ * @see #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)
*/
public static final int SESSION_MODIFY_REQUEST_SUCCESS = 1;
/**
* Session modify request failed.
+ * @see #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)
*/
public static final int SESSION_MODIFY_REQUEST_FAIL = 2;
/**
* Session modify request ignored due to invalid parameters.
+ * @see #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)
*/
public static final int SESSION_MODIFY_REQUEST_INVALID = 3;
/**
* Session modify request timed out.
+ * @see #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)
*/
public static final int SESSION_MODIFY_REQUEST_TIMED_OUT = 4;
/**
- * Session modify request rejected by remote UE.
+ * Session modify request rejected by remote user.
+ * @see #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)
*/
public static final int SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE = 5;
@@ -566,9 +597,17 @@ public abstract class Connection extends Conferenceable {
}
/**
- * Sets the camera to be used for video recording in a video connection.
+ * Sets the camera to be used for the outgoing video.
+ * <p>
+ * The {@link VideoProvider} should respond by communicating the capabilities of the chosen
+ * camera via
+ * {@link VideoProvider#changeCameraCapabilities(VideoProfile.CameraCapabilities)}.
+ * <p>
+ * Sent from the {@link InCallService} via
+ * {@link InCallService.VideoCall#setCamera(String)}.
*
- * @param cameraId The id of the camera.
+ * @param cameraId The id of the camera (use ids as reported by
+ * {@link CameraManager#getCameraIdList()}).
*/
public abstract void onSetCamera(String cameraId);
@@ -576,21 +615,30 @@ public abstract class Connection extends Conferenceable {
* Sets the surface to be used for displaying a preview of what the user's camera is
* currently capturing. When video transmission is enabled, this is the video signal which
* is sent to the remote device.
+ * <p>
+ * Sent from the {@link InCallService} via
+ * {@link InCallService.VideoCall#setPreviewSurface(Surface)}.
*
- * @param surface The surface.
+ * @param surface The {@link Surface}.
*/
public abstract void onSetPreviewSurface(Surface surface);
/**
* Sets the surface to be used for displaying the video received from the remote device.
+ * <p>
+ * Sent from the {@link InCallService} via
+ * {@link InCallService.VideoCall#setDisplaySurface(Surface)}.
*
- * @param surface The surface.
+ * @param surface The {@link Surface}.
*/
public abstract void onSetDisplaySurface(Surface surface);
/**
* Sets the device orientation, in degrees. Assumes that a standard portrait orientation of
* the device is 0 degrees.
+ * <p>
+ * Sent from the {@link InCallService} via
+ * {@link InCallService.VideoCall#setDeviceOrientation(int)}.
*
* @param rotation The device orientation, in degrees.
*/
@@ -598,57 +646,100 @@ public abstract class Connection extends Conferenceable {
/**
* Sets camera zoom ratio.
+ * <p>
+ * Sent from the {@link InCallService} via {@link InCallService.VideoCall#setZoom(float)}.
*
* @param value The camera zoom ratio.
*/
public abstract void onSetZoom(float value);
/**
- * 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 connection from audio to video,
- * downgrade connection from video to audio, pause video.
+ * Issues a request to modify the properties of the current video session.
+ * <p>
+ * Example scenarios include: requesting an audio-only call to be upgraded to a
+ * bi-directional video call, turning on or off the user's camera, sending a pause signal
+ * when the {@link InCallService} is no longer the foreground application.
+ * <p>
+ * If the {@link VideoProvider} determines a request to be invalid, it should call
+ * {@link #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)} to report the
+ * invalid request back to the {@link InCallService}.
+ * <p>
+ * Where a request requires confirmation from the user of the peer device, the
+ * {@link VideoProvider} must communicate the request to the peer device and handle the
+ * user's response. {@link #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)}
+ * is used to inform the {@link InCallService} of the result of the request.
+ * <p>
+ * Sent from the {@link InCallService} via
+ * {@link InCallService.VideoCall#sendSessionModifyRequest(VideoProfile)}.
*
- * @param fromProfile The video properties prior to the request.
- * @param toProfile The video properties with the requested changes made.
+ * @param fromProfile The video profile prior to the request.
+ * @param toProfile The video profile with the requested changes made.
*/
public abstract void onSendSessionModifyRequest(VideoProfile fromProfile,
VideoProfile toProfile);
- /**te
- * 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.
+ /**
+ * Provides a response to a request to change the current video session properties.
+ * <p>
+ * For example, if the peer requests and upgrade from an audio-only call to a bi-directional
+ * video call, could decline the request and keep the call as audio-only.
+ * In such a scenario, the {@code responseProfile} would have a video state of
+ * {@link VideoProfile#STATE_AUDIO_ONLY}. If the user had decided to accept the request,
+ * the video state would be {@link VideoProfile#STATE_BIDIRECTIONAL}.
+ * <p>
+ * Sent from the {@link InCallService} via
+ * {@link InCallService.VideoCall#sendSessionModifyResponse(VideoProfile)} in response to
+ * a {@link InCallService.VideoCall.Callback#onSessionModifyRequestReceived(VideoProfile)}
+ * callback.
*
- * @param responseProfile The response connection video properties.
+ * @param responseProfile The response video profile.
*/
public abstract void onSendSessionModifyResponse(VideoProfile responseProfile);
/**
- * Issues a request to the video provider to retrieve the camera capabilities.
- * Camera capabilities are reported back to the caller via the In-Call UI.
+ * Issues a request to the {@link VideoProvider} to retrieve the camera capabilities.
+ * <p>
+ * The {@link VideoProvider} should respond by communicating the capabilities of the chosen
+ * camera via
+ * {@link VideoProvider#changeCameraCapabilities(VideoProfile.CameraCapabilities)}.
+ * <p>
+ * Sent from the {@link InCallService} via
+ * {@link InCallService.VideoCall#requestCameraCapabilities()}.
*/
public abstract void onRequestCameraCapabilities();
/**
- * Issues a request to the video telephony framework to retrieve the cumulative data usage
- * for the current connection. Data usage is reported back to the caller via the
- * InCall UI.
+ * Issues a request to the {@link VideoProvider} to retrieve the current data usage for the
+ * video component of the current {@link Connection}.
+ * <p>
+ * The {@link VideoProvider} should respond by communicating current data usage, in bytes,
+ * via {@link VideoProvider#setCallDataUsage(long)}.
+ * <p>
+ * Sent from the {@link InCallService} via
+ * {@link InCallService.VideoCall#requestCallDataUsage()}.
*/
public abstract void onRequestConnectionDataUsage();
/**
- * Provides the video telephony framework with the URI of an image to be displayed to remote
- * devices when the video signal is paused.
+ * Provides the {@link VideoProvider} with the {@link Uri} of an image to be displayed to
+ * the peer device when the video signal is paused.
+ * <p>
+ * Sent from the {@link InCallService} via
+ * {@link InCallService.VideoCall#setPauseImage(Uri)}.
*
* @param uri URI of image to display.
*/
public abstract void onSetPauseImage(Uri uri);
/**
- * Invokes callback method defined in listening {@link InCallService} implementations.
+ * Used to inform listening {@link InCallService} implementations when the
+ * {@link VideoProvider} receives a session modification request.
+ * <p>
+ * Received by the {@link InCallService} via
+ * {@link InCallService.VideoCall.Callback#onSessionModifyRequestReceived(VideoProfile)},
*
- * @param videoProfile The requested video connection profile.
+ * @param videoProfile The requested video profile.
+ * @see #onSendSessionModifyRequest(VideoProfile, VideoProfile)
*/
public void receiveSessionModifyRequest(VideoProfile videoProfile) {
if (mVideoCallbacks != null) {
@@ -662,14 +753,22 @@ public abstract class Connection extends Conferenceable {
}
/**
- * Invokes callback method defined in listening {@link InCallService} implementations.
+ * Used to inform listening {@link InCallService} implementations when the
+ * {@link VideoProvider} receives a response to a session modification request.
+ * <p>
+ * Received by the {@link InCallService} via
+ * {@link InCallService.VideoCall.Callback#onSessionModifyResponseReceived(int,
+ * VideoProfile, VideoProfile)}.
*
* @param status Status of the session modify request. Valid values are
* {@link VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS},
* {@link VideoProvider#SESSION_MODIFY_REQUEST_FAIL},
- * {@link VideoProvider#SESSION_MODIFY_REQUEST_INVALID}
- * @param requestedProfile The original request which was sent to the remote device.
- * @param responseProfile The actual profile changes made by the remote device.
+ * {@link VideoProvider#SESSION_MODIFY_REQUEST_INVALID},
+ * {@link VideoProvider#SESSION_MODIFY_REQUEST_TIMED_OUT},
+ * {@link VideoProvider#SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE}
+ * @param requestedProfile The original request which was sent to the peer device.
+ * @param responseProfile The actual profile changes agreed to by the peer device.
+ * @see #onSendSessionModifyRequest(VideoProfile, VideoProfile)
*/
public void receiveSessionModifyResponse(int status,
VideoProfile requestedProfile, VideoProfile responseProfile) {
@@ -685,14 +784,18 @@ public abstract class Connection extends Conferenceable {
}
/**
- * Invokes callback method defined in listening {@link InCallService} implementations.
- *
- * Valid values are: {@link VideoProvider#SESSION_EVENT_RX_PAUSE},
- * {@link VideoProvider#SESSION_EVENT_RX_RESUME},
- * {@link VideoProvider#SESSION_EVENT_TX_START},
- * {@link VideoProvider#SESSION_EVENT_TX_STOP}
+ * Used to inform listening {@link InCallService} implementations when the
+ * {@link VideoProvider} reports a call session event.
+ * <p>
+ * Received by the {@link InCallService} via
+ * {@link InCallService.VideoCall.Callback#onCallSessionEvent(int)}.
*
- * @param event The event.
+ * @param event The event. Valid values are: {@link VideoProvider#SESSION_EVENT_RX_PAUSE},
+ * {@link VideoProvider#SESSION_EVENT_RX_RESUME},
+ * {@link VideoProvider#SESSION_EVENT_TX_START},
+ * {@link VideoProvider#SESSION_EVENT_TX_STOP},
+ * {@link VideoProvider#SESSION_EVENT_CAMERA_FAILURE},
+ * {@link VideoProvider#SESSION_EVENT_CAMERA_READY}.
*/
public void handleCallSessionEvent(int event) {
if (mVideoCallbacks != null) {
@@ -706,7 +809,14 @@ public abstract class Connection extends Conferenceable {
}
/**
- * Invokes callback method defined in listening {@link InCallService} implementations.
+ * Used to inform listening {@link InCallService} implementations when the dimensions of the
+ * peer's video have changed.
+ * <p>
+ * This could occur if, for example, the peer rotates their device, changing the aspect
+ * ratio of the video, or if the user switches between the back and front cameras.
+ * <p>
+ * Received by the {@link InCallService} via
+ * {@link InCallService.VideoCall.Callback#onPeerDimensionsChanged(int, int)}.
*
* @param width The updated peer video width.
* @param height The updated peer video height.
@@ -723,9 +833,18 @@ public abstract class Connection extends Conferenceable {
}
/**
- * Invokes callback method defined in listening {@link InCallService} implementations.
+ * Used to inform listening {@link InCallService} implementations when the data usage of the
+ * video associated with the current {@link Connection} has changed.
+ * <p>
+ * This could be in response to a preview request via
+ * {@link #onRequestConnectionDataUsage()}, or as a periodic update by the
+ * {@link VideoProvider}.
+ * <p>
+ * Received by the {@link InCallService} via
+ * {@link InCallService.VideoCall.Callback#onCallDataUsageChanged(long)}.
*
- * @param dataUsage The updated data usage.
+ * @param dataUsage The updated data usage (in bytes). Reported as the cumulative bytes
+ * used since the start of the call.
*/
public void setCallDataUsage(long dataUsage) {
if (mVideoCallbacks != null) {
@@ -739,9 +858,9 @@ public abstract class Connection extends Conferenceable {
}
/**
- * Invokes callback method defined in listening {@link InCallService} implementations.
+ * @see #setCallDataUsage(long)
*
- * @param dataUsage The updated data usage.
+ * @param dataUsage The updated data usage (in byes).
* @deprecated - Use {@link #setCallDataUsage(long)} instead.
* @hide
*/
@@ -750,9 +869,18 @@ public abstract class Connection extends Conferenceable {
}
/**
- * Invokes callback method defined in listening {@link InCallService} implementations.
+ * Used to inform listening {@link InCallService} implementations when the capabilities of
+ * the current camera have changed.
+ * <p>
+ * The {@link VideoProvider} should call this in response to
+ * {@link VideoProvider#onRequestCameraCapabilities()}, or when the current camera is
+ * changed via {@link VideoProvider#onSetCamera(String)}.
+ * <p>
+ * Received by the {@link InCallService} via
+ * {@link InCallService.VideoCall.Callback#onCameraCapabilitiesChanged(
+ * VideoProfile.CameraCapabilities)}.
*
- * @param cameraCapabilities The changed camera capabilities.
+ * @param cameraCapabilities The new camera capabilities.
*/
public void changeCameraCapabilities(VideoProfile.CameraCapabilities cameraCapabilities) {
if (mVideoCallbacks != null) {
@@ -766,15 +894,17 @@ public abstract class Connection extends Conferenceable {
}
/**
- * Invokes callback method defined in listening {@link InCallService} implementations.
- *
- * Allowed values:
- * {@link VideoProfile#QUALITY_HIGH},
- * {@link VideoProfile#QUALITY_MEDIUM},
- * {@link VideoProfile#QUALITY_LOW},
- * {@link VideoProfile#QUALITY_DEFAULT}.
+ * Used to inform listening {@link InCallService} implementations when the video quality
+ * of the call has changed.
+ * <p>
+ * Received by the {@link InCallService} via
+ * {@link InCallService.VideoCall.Callback#onVideoQualityChanged(int)}.
*
- * @param videoQuality The updated video quality.
+ * @param videoQuality The updated video quality. Valid values:
+ * {@link VideoProfile#QUALITY_HIGH},
+ * {@link VideoProfile#QUALITY_MEDIUM},
+ * {@link VideoProfile#QUALITY_LOW},
+ * {@link VideoProfile#QUALITY_DEFAULT}.
*/
public void changeVideoQuality(int videoQuality) {
if (mVideoCallbacks != null) {
@@ -832,6 +962,7 @@ public abstract class Connection extends Conferenceable {
private DisconnectCause mDisconnectCause;
private Conference mConference;
private ConnectionService mConnectionService;
+ private Bundle mExtras;
/**
* Create a new Connection.
@@ -942,6 +1073,13 @@ public abstract class Connection extends Conferenceable {
}
/**
+ * @return The extras associated with this connection.
+ */
+ public final Bundle getExtras() {
+ return mExtras;
+ }
+
+ /**
* Assign a listener to be notified of state changes.
*
* @param l A listener.
@@ -1371,6 +1509,21 @@ public abstract class Connection extends Conferenceable {
}
/**
+ * Set some extras that can be associated with this {@code Connection}. No assumptions should
+ * be made as to how an In-Call UI or service will handle these extras.
+ * Keys should be fully qualified (e.g., com.example.MY_EXTRA) to avoid conflicts.
+ *
+ * @param extras The extras associated with this {@code Connection}.
+ */
+ public final void setExtras(@Nullable Bundle extras) {
+ checkImmutable();
+ mExtras = extras;
+ for (Listener l : mListeners) {
+ l.onExtrasChanged(this, extras);
+ }
+ }
+
+ /**
* Notifies this Connection that the {@link #getAudioState()} property has a new value.
*
* @param state The new connection audio state.
@@ -1455,7 +1608,7 @@ public abstract class Connection extends Conferenceable {
* a request to accept.
*/
public void onAnswer() {
- onAnswer(VideoProfile.VideoState.AUDIO_ONLY);
+ onAnswer(VideoProfile.STATE_AUDIO_ONLY);
}
/**
diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java
index 975df5d..6863214 100644
--- a/telecomm/java/android/telecom/ConnectionRequest.java
+++ b/telecomm/java/android/telecom/ConnectionRequest.java
@@ -42,7 +42,7 @@ public final class ConnectionRequest implements Parcelable {
PhoneAccountHandle accountHandle,
Uri handle,
Bundle extras) {
- this(accountHandle, handle, extras, VideoProfile.VideoState.AUDIO_ONLY);
+ this(accountHandle, handle, extras, VideoProfile.STATE_AUDIO_ONLY);
}
/**
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index 199100b..1e8ae88 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -21,6 +21,7 @@ import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
+import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
@@ -432,6 +433,12 @@ public abstract class ConnectionService extends Service {
String id = mIdByConference.get(conference);
mAdapter.setStatusHints(id, statusHints);
}
+
+ @Override
+ public void onExtrasChanged(Conference conference, Bundle extras) {
+ String id = mIdByConference.get(conference);
+ mAdapter.setExtras(id, extras);
+ }
};
private final Connection.Listener mConnectionListener = new Connection.Listener() {
@@ -569,6 +576,14 @@ public abstract class ConnectionService extends Service {
mAdapter.onConferenceMergeFailed(id);
}
}
+
+ @Override
+ public void onExtrasChanged(Connection connection, Bundle extras) {
+ String id = mIdByConnection.get(connection);
+ if (id != null) {
+ mAdapter.setExtras(id, extras);
+ }
+ }
};
/** {@inheritDoc} */
@@ -638,7 +653,8 @@ public abstract class ConnectionService extends Service {
connection.getAudioModeIsVoip(),
connection.getStatusHints(),
connection.getDisconnectCause(),
- createIdList(connection.getConferenceables())));
+ createIdList(connection.getConferenceables()),
+ connection.getExtras()));
}
private void abort(String callId) {
@@ -919,7 +935,8 @@ public abstract class ConnectionService extends Service {
null : conference.getVideoProvider().getInterface(),
conference.getVideoState(),
conference.getConnectTimeMillis(),
- conference.getStatusHints());
+ conference.getStatusHints(),
+ conference.getExtras());
mAdapter.addConferenceCall(id, parcelableConference);
mAdapter.setVideoProvider(id, conference.getVideoProvider());
@@ -964,7 +981,8 @@ public abstract class ConnectionService extends Service {
connection.getAudioModeIsVoip(),
connection.getStatusHints(),
connection.getDisconnectCause(),
- emptyList);
+ emptyList,
+ connection.getExtras());
mAdapter.addExistingConnection(id, parcelableConnection);
}
}
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
index a87dbe7..4ab9ee5 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
@@ -17,6 +17,7 @@
package android.telecom;
import android.net.Uri;
+import android.os.Bundle;
import android.os.IBinder.DeathRecipient;
import android.os.RemoteException;
@@ -341,10 +342,10 @@ final class ConnectionServiceAdapter implements DeathRecipient {
/**
* Sets the video state associated with a call.
*
- * Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY},
- * {@link VideoProfile.VideoState#BIDIRECTIONAL},
- * {@link VideoProfile.VideoState#TX_ENABLED},
- * {@link VideoProfile.VideoState#RX_ENABLED}.
+ * Valid values: {@link VideoProfile#STATE_BIDIRECTIONAL},
+ * {@link VideoProfile#STATE_AUDIO_ONLY},
+ * {@link VideoProfile#STATE_TX_ENABLED},
+ * {@link VideoProfile#STATE_RX_ENABLED}.
*
* @param callId The unique ID of the call to set the video state for.
* @param videoState The video state.
@@ -384,4 +385,20 @@ final class ConnectionServiceAdapter implements DeathRecipient {
}
}
}
+
+ /**
+ * Sets extras associated with a connection.
+ *
+ * @param callId The unique ID of the call.
+ * @param extras The extras to associate with this call.
+ */
+ void setExtras(String callId, Bundle extras) {
+ Log.v(this, "setExtras: %s", extras);
+ for (IConnectionServiceAdapter adapter : mAdapters) {
+ try {
+ adapter.setExtras(callId, extras);
+ } catch (RemoteException ignored) {
+ }
+ }
+ }
}
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
index db815ba..293dc11 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
@@ -17,6 +17,7 @@
package android.telecom;
import android.net.Uri;
+import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
@@ -60,6 +61,7 @@ final class ConnectionServiceAdapterServant {
private static final int MSG_ADD_EXISTING_CONNECTION = 21;
private static final int MSG_ON_POST_DIAL_CHAR = 22;
private static final int MSG_SET_CONFERENCE_MERGE_FAILED = 23;
+ private static final int MSG_SET_EXTRAS = 24;
private final IConnectionServiceAdapter mDelegate;
@@ -230,6 +232,14 @@ final class ConnectionServiceAdapterServant {
}
break;
}
+ case MSG_SET_EXTRAS: {
+ SomeArgs args = (SomeArgs) msg.obj;
+ try {
+ mDelegate.setExtras((String) args.arg1, (Bundle) args.arg2);
+ } finally {
+ args.recycle();
+ }
+ }
}
}
};
@@ -401,6 +411,14 @@ final class ConnectionServiceAdapterServant {
args.arg2 = connection;
mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
}
+
+ @Override
+ public final void setExtras(String connectionId, Bundle extras) {
+ SomeArgs args = SomeArgs.obtain();
+ args.arg1 = connectionId;
+ args.arg2 = extras;
+ mHandler.obtainMessage(MSG_SET_EXTRAS, args).sendToTarget();
+ }
};
public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
diff --git a/telecomm/java/android/telecom/DefaultDialerManager.java b/telecomm/java/android/telecom/DefaultDialerManager.java
index d3df151..3d49308 100644
--- a/telecomm/java/android/telecom/DefaultDialerManager.java
+++ b/telecomm/java/android/telecom/DefaultDialerManager.java
@@ -41,10 +41,13 @@ public class DefaultDialerManager {
* The caller of this method needs to have permission to write to secure settings and
* manage users on the device.
*
+ * @return {@code true} if the default dialer application was successfully changed,
+ * {@code false} otherwise.
+ *
* @hide
* */
- public static void setDefaultDialerApplication(Context context, String packageName) {
- setDefaultDialerApplication(context, packageName, ActivityManager.getCurrentUser());
+ public static boolean setDefaultDialerApplication(Context context, String packageName) {
+ return setDefaultDialerApplication(context, packageName, ActivityManager.getCurrentUser());
}
/**
@@ -52,16 +55,20 @@ public class DefaultDialerManager {
* The caller of this method needs to have permission to write to secure settings and
* manage users on the device.
*
+ * @return {@code true} if the default dialer application was successfully changed,
+ * {@code false} otherwise.
+ *
* @hide
* */
- public static void setDefaultDialerApplication(Context context, String packageName, int user) {
+ public static boolean setDefaultDialerApplication(Context context, String packageName,
+ int user) {
// Get old package name
String oldPackageName = Settings.Secure.getStringForUser(context.getContentResolver(),
Settings.Secure.DIALER_DEFAULT_APPLICATION, user);
if (packageName != null && oldPackageName != null && packageName.equals(oldPackageName)) {
// No change
- return;
+ return false;
}
// Only make the change if the new package belongs to a valid phone application
@@ -71,7 +78,9 @@ public class DefaultDialerManager {
// Update the secure setting.
Settings.Secure.putStringForUser(context.getContentResolver(),
Settings.Secure.DIALER_DEFAULT_APPLICATION, packageName, user);
+ return true;
}
+ return false;
}
/**
diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java
index e37cff7..f7f4425 100644
--- a/telecomm/java/android/telecom/InCallService.java
+++ b/telecomm/java/android/telecom/InCallService.java
@@ -20,6 +20,7 @@ import android.annotation.SdkConstant;
import android.annotation.SystemApi;
import android.app.Service;
import android.content.Intent;
+import android.hardware.camera2.CameraManager;
import android.net.Uri;
import android.os.Handler;
import android.os.IBinder;
@@ -387,7 +388,8 @@ public abstract class InCallService extends Service {
}
/**
- * Class to invoke functionality related to video calls.
+ * Used to issue commands to the {@link Connection.VideoProvider} associated with a
+ * {@link Call}.
*/
public static abstract class VideoCall {
@@ -410,14 +412,17 @@ public abstract class InCallService extends Service {
public abstract void registerCallback(VideoCall.Callback callback, Handler handler);
/**
- * Clears the video call listener set via {@link #registerCallback}.
+ * Clears the video call callback set via {@link #registerCallback}.
*/
public abstract void unregisterCallback(VideoCall.Callback callback);
/**
- * Sets the camera to be used for video recording in a video call.
+ * Sets the camera to be used for the outgoing video.
+ * <p>
+ * Handled by {@link Connection.VideoProvider#onSetCamera(String)}.
*
- * @param cameraId The id of the camera.
+ * @param cameraId The id of the camera (use ids as reported by
+ * {@link CameraManager#getCameraIdList()}).
*/
public abstract void setCamera(String cameraId);
@@ -425,21 +430,27 @@ public abstract class InCallService extends Service {
* Sets the surface to be used for displaying a preview of what the user's camera is
* currently capturing. When video transmission is enabled, this is the video signal which
* is sent to the remote device.
+ * <p>
+ * Handled by {@link Connection.VideoProvider#onSetPreviewSurface(Surface)}.
*
- * @param surface The surface.
+ * @param surface The {@link Surface}.
*/
public abstract void setPreviewSurface(Surface surface);
/**
* Sets the surface to be used for displaying the video received from the remote device.
+ * <p>
+ * Handled by {@link Connection.VideoProvider#onSetDisplaySurface(Surface)}.
*
- * @param surface The surface.
+ * @param surface The {@link Surface}.
*/
public abstract void setDisplaySurface(Surface surface);
/**
* Sets the device orientation, in degrees. Assumes that a standard portrait orientation of
* the device is 0 degrees.
+ * <p>
+ * Handled by {@link Connection.VideoProvider#onSetDeviceOrientation(int)}.
*
* @param rotation The device orientation, in degrees.
*/
@@ -447,109 +458,145 @@ public abstract class InCallService extends Service {
/**
* Sets camera zoom ratio.
+ * <p>
+ * Handled by {@link Connection.VideoProvider#onSetZoom(float)}.
*
* @param value The camera zoom ratio.
*/
public abstract void setZoom(float value);
/**
- * Issues a request to modify the properties of the current session. The request is sent to
- * the remote device where it it handled by
- * {@link VideoCall.Callback#onSessionModifyRequestReceived}.
- * Some examples of session modification requests: upgrade call from audio to video,
- * downgrade call from video to audio, pause video.
+ * Issues a request to modify the properties of the current video session.
+ * <p>
+ * Example scenarios include: requesting an audio-only call to be upgraded to a
+ * bi-directional video call, turning on or off the user's camera, sending a pause signal
+ * when the {@link InCallService} is no longer the foreground application.
+ * <p>
+ * Handled by
+ * {@link Connection.VideoProvider#onSendSessionModifyRequest(VideoProfile, VideoProfile)}.
*
* @param requestProfile The requested call video properties.
*/
public abstract void sendSessionModifyRequest(VideoProfile requestProfile);
/**
- * Provides a response to a request to change the current call session video
- * properties.
- * This is in response to a request the InCall UI has received via
- * {@link VideoCall.Callback#onSessionModifyRequestReceived}.
- * The response is handled on the remove device by
- * {@link VideoCall.Callback#onSessionModifyResponseReceived}.
+ * Provides a response to a request to change the current call video session
+ * properties. This should be called in response to a request the {@link InCallService} has
+ * received via {@link VideoCall.Callback#onSessionModifyRequestReceived}.
+ * <p>
+ * Handled by
+ * {@link Connection.VideoProvider#onSendSessionModifyResponse(VideoProfile)}.
*
* @param responseProfile The response call video properties.
*/
public abstract void sendSessionModifyResponse(VideoProfile responseProfile);
/**
- * Issues a request to the video provider to retrieve the camera capabilities.
- * Camera capabilities are reported back to the caller via
- * {@link VideoCall.Callback#onCameraCapabilitiesChanged(CameraCapabilities)}.
+ * Issues a request to the {@link Connection.VideoProvider} to retrieve the capabilities
+ * of the current camera. The current camera is selected using
+ * {@link VideoCall#setCamera(String)}.
+ * <p>
+ * Camera capabilities are reported to the caller via
+ * {@link VideoCall.Callback#onCameraCapabilitiesChanged(VideoProfile.CameraCapabilities)}.
+ * <p>
+ * Handled by {@link Connection.VideoProvider#onRequestCameraCapabilities()}.
*/
public abstract void requestCameraCapabilities();
/**
- * 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
- * {@link VideoCall.Callback#onCallDataUsageChanged}.
+ * Issues a request to the {@link Connection.VideoProvider} to retrieve the cumulative data
+ * usage for the video component of the current call (in bytes). Data usage is reported
+ * to the caller via {@link VideoCall.Callback#onCallDataUsageChanged}.
+ * <p>
+ * Handled by {@link Connection.VideoProvider#onRequestConnectionDataUsage()}.
*/
public abstract void requestCallDataUsage();
/**
- * Provides the video telephony framework with the URI of an image to be displayed to remote
- * devices when the video signal is paused.
+ * Provides the {@link Connection.VideoProvider} with the {@link Uri} of an image to be
+ * displayed to the peer device when the video signal is paused.
+ * <p>
+ * Handled by {@link Connection.VideoProvider#onSetPauseImage(Uri)}.
*
* @param uri URI of image to display.
*/
public abstract void setPauseImage(Uri uri);
/**
- * Callback class which invokes callbacks after video call actions occur.
+ * The {@link InCallService} extends this class to provide a means of receiving callbacks
+ * from the {@link Connection.VideoProvider}.<p>
+ * When the {@link InCallService} receives the
+ * {@link Call.Callback#onVideoCallChanged(Call, VideoCall)} callback, it should create an
+ * instance its {@link VideoCall.Callback} implementation and set it on the
+ * {@link VideoCall} using {@link VideoCall#registerCallback(Callback)}.
*/
public static abstract class Callback {
/**
- * Called when a session modification request is received from the remote device.
- * The remote request is sent via
- * {@link Connection.VideoProvider#onSendSessionModifyRequest}. The InCall UI
- * is responsible for potentially prompting the user whether they wish to accept the new
- * call profile (e.g. prompt user if they wish to accept an upgrade from an audio to a
- * video call) and should call
- * {@link Connection.VideoProvider#onSendSessionModifyResponse} to indicate
- * the video settings the user has agreed to.
+ * Called when the {@link Connection.VideoProvider} receives a session modification
+ * request is received from the peer device.
+ * <p>
+ * The {@link InCallService} may potentially prompt the user to confirm whether they
+ * wish to accept the request, or decide to automatically accept the request. In either
+ * case the {@link InCallService} should call
+ * {@link VideoCall#sendSessionModifyResponse(VideoProfile)} to indicate the video
+ * profile agreed upon.
+ * <p>
+ * Callback originates from
+ * {@link Connection.VideoProvider#receiveSessionModifyRequest(VideoProfile)}.
*
- * @param videoProfile The requested video call profile.
+ * @param videoProfile The requested video profile.
*/
public abstract void onSessionModifyRequestReceived(VideoProfile videoProfile);
/**
- * Called when a response to a session modification request is received from the remote
- * device. The remote InCall UI sends the response using
- * {@link Connection.VideoProvider#onSendSessionModifyResponse}.
+ * Called when the {@link Connection.VideoProvider} receives a response to a session
+ * modification request previously sent to the peer device.
+ * <p>
+ * The new video state should not be considered active by the {@link InCallService}
+ * until the {@link Call} video state changes (the
+ * {@link Call.Callback#onDetailsChanged(Call, Call.Details)} callback is triggered
+ * when the video state changes).
+ * <p>
+ * Callback originates from
+ * {@link Connection.VideoProvider#receiveSessionModifyResponse(int, VideoProfile,
+ * VideoProfile)}.
*
* @param status Status of the session modify request. Valid values are
- * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS},
- * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_FAIL},
- * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_INVALID}
- * @param requestedProfile The original request which was sent to the remote device.
- * @param responseProfile The actual profile changes made by the remote device.
+ * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS},
+ * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_FAIL},
+ * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_INVALID},
+ * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_TIMED_OUT},
+ * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE}.
+ * @param requestedProfile The original request which was sent to the peer device.
+ * @param responseProfile The actual profile changes made by the peer device.
*/
public abstract void onSessionModifyResponseReceived(int status,
VideoProfile requestedProfile, VideoProfile responseProfile);
/**
- * Handles events related to the current session which the client may wish to handle.
- * These are separate from requested changes to the session due to the underlying
- * protocol or connection.
+ * Handles events related to the current video session which the {@link InCallService}
+ * may wish to handle. These are separate from requested changes to the session due to
+ * the underlying protocol or connection.
+ * <p>
+ * Callback originates from
+ * {@link Connection.VideoProvider#handleCallSessionEvent(int)}.
*
- * Valid values are:
- * {@link Connection.VideoProvider#SESSION_EVENT_RX_PAUSE},
- * {@link Connection.VideoProvider#SESSION_EVENT_RX_RESUME},
- * {@link Connection.VideoProvider#SESSION_EVENT_TX_START},
- * {@link Connection.VideoProvider#SESSION_EVENT_TX_STOP},
- * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_FAILURE},
- * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_READY}
- *
- * @param event The event.
+ * @param event The event. Valid values are:
+ * {@link Connection.VideoProvider#SESSION_EVENT_RX_PAUSE},
+ * {@link Connection.VideoProvider#SESSION_EVENT_RX_RESUME},
+ * {@link Connection.VideoProvider#SESSION_EVENT_TX_START},
+ * {@link Connection.VideoProvider#SESSION_EVENT_TX_STOP},
+ * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_FAILURE},
+ * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_READY}.
*/
public abstract void onCallSessionEvent(int event);
/**
- * Handles a change to the video dimensions from the remote caller (peer). This could
- * happen if, for example, the peer changes orientation of their device.
+ * Handles a change to the video dimensions from the peer device. This could happen if,
+ * for example, the peer changes orientation of their device, or switches cameras.
+ * <p>
+ * Callback originates from
+ * {@link Connection.VideoProvider#changePeerDimensions(int, int)}.
*
* @param width The updated peer video width.
* @param height The updated peer video height.
@@ -558,20 +605,41 @@ public abstract class InCallService extends Service {
/**
* Handles a change to the video quality.
+ * <p>
+ * Callback originates from {@link Connection.VideoProvider#changeVideoQuality(int)}.
*
- * @param videoQuality The updated peer video quality.
+ * @param videoQuality The updated peer video quality. Valid values:
+ * {@link VideoProfile#QUALITY_HIGH},
+ * {@link VideoProfile#QUALITY_MEDIUM},
+ * {@link VideoProfile#QUALITY_LOW},
+ * {@link VideoProfile#QUALITY_DEFAULT}.
*/
public abstract void onVideoQualityChanged(int videoQuality);
/**
- * Handles an update to the total data used for the current session.
+ * Handles an update to the total data used for the current video session.
+ * <p>
+ * Used by the {@link Connection.VideoProvider} in response to
+ * {@link VideoCall#requestCallDataUsage()}. May also be called periodically by the
+ * {@link Connection.VideoProvider}.
+ * <p>
+ * Callback originates from {@link Connection.VideoProvider#setCallDataUsage(long)}.
*
- * @param dataUsage The updated data usage.
+ * @param dataUsage The updated data usage (in bytes).
*/
public abstract void onCallDataUsageChanged(long dataUsage);
/**
- * Handles a change in camera capabilities.
+ * Handles a change in the capabilities of the currently selected camera.
+ * <p>
+ * Used by the {@link Connection.VideoProvider} in response to
+ * {@link VideoCall#requestCameraCapabilities()}. The {@link Connection.VideoProvider}
+ * may also report the camera capabilities after a call to
+ * {@link VideoCall#setCamera(String)}.
+ * <p>
+ * Callback originates from
+ * {@link Connection.VideoProvider#changeCameraCapabilities(
+ * VideoProfile.CameraCapabilities)}.
*
* @param cameraCapabilities The changed camera capabilities.
*/
diff --git a/telecomm/java/android/telecom/ParcelableCall.java b/telecomm/java/android/telecom/ParcelableCall.java
index bb65ce9..8cf4aeb 100644
--- a/telecomm/java/android/telecom/ParcelableCall.java
+++ b/telecomm/java/android/telecom/ParcelableCall.java
@@ -54,6 +54,7 @@ public final class ParcelableCall implements Parcelable {
private final StatusHints mStatusHints;
private final int mVideoState;
private final List<String> mConferenceableCallIds;
+ private final Bundle mIntentExtras;
private final Bundle mExtras;
public ParcelableCall(
@@ -77,6 +78,7 @@ public final class ParcelableCall implements Parcelable {
StatusHints statusHints,
int videoState,
List<String> conferenceableCallIds,
+ Bundle intentExtras,
Bundle extras) {
mId = id;
mState = state;
@@ -98,6 +100,7 @@ public final class ParcelableCall implements Parcelable {
mStatusHints = statusHints;
mVideoState = videoState;
mConferenceableCallIds = Collections.unmodifiableList(conferenceableCallIds);
+ mIntentExtras = intentExtras;
mExtras = extras;
}
@@ -227,7 +230,7 @@ public final class ParcelableCall implements Parcelable {
}
/**
- * Any extras to pass with the call
+ * Any extras associated with this call.
*
* @return a bundle of extras
*/
@@ -236,6 +239,15 @@ public final class ParcelableCall implements Parcelable {
}
/**
+ * Extras passed in as part of the original call intent.
+ *
+ * @return The intent extras.
+ */
+ public Bundle getIntentExtras() {
+ return mIntentExtras;
+ }
+
+ /**
* Indicates to the receiver of the {@link ParcelableCall} whether a change has occurred in the
* {@link android.telecom.InCallService.VideoCall} associated with this call. Since
* {@link #getVideoCall()} creates a new {@link VideoCallImpl}, it is useful to know whether
@@ -277,7 +289,8 @@ public final class ParcelableCall implements Parcelable {
int videoState = source.readInt();
List<String> conferenceableCallIds = new ArrayList<>();
source.readList(conferenceableCallIds, classLoader);
- Bundle extras = source.readParcelable(classLoader);
+ Bundle intentExtras = source.readBundle(classLoader);
+ Bundle extras = source.readBundle(classLoader);
return new ParcelableCall(
id,
state,
@@ -299,6 +312,7 @@ public final class ParcelableCall implements Parcelable {
statusHints,
videoState,
conferenceableCallIds,
+ intentExtras,
extras);
}
@@ -338,7 +352,8 @@ public final class ParcelableCall implements Parcelable {
destination.writeParcelable(mStatusHints, 0);
destination.writeInt(mVideoState);
destination.writeList(mConferenceableCallIds);
- destination.writeParcelable(mExtras, 0);
+ destination.writeBundle(mIntentExtras);
+ destination.writeBundle(mExtras);
}
@Override
diff --git a/telecomm/java/android/telecom/ParcelableConference.java b/telecomm/java/android/telecom/ParcelableConference.java
index 3d0c558..870f5ee 100644
--- a/telecomm/java/android/telecom/ParcelableConference.java
+++ b/telecomm/java/android/telecom/ParcelableConference.java
@@ -16,6 +16,7 @@
package android.telecom;
+import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@@ -38,6 +39,7 @@ public final class ParcelableConference implements Parcelable {
private final IVideoProvider mVideoProvider;
private final int mVideoState;
private StatusHints mStatusHints;
+ private Bundle mExtras;
public ParcelableConference(
PhoneAccountHandle phoneAccount,
@@ -47,7 +49,8 @@ public final class ParcelableConference implements Parcelable {
IVideoProvider videoProvider,
int videoState,
long connectTimeMillis,
- StatusHints statusHints) {
+ StatusHints statusHints,
+ Bundle extras) {
mPhoneAccount = phoneAccount;
mState = state;
mConnectionCapabilities = connectionCapabilities;
@@ -57,6 +60,7 @@ public final class ParcelableConference implements Parcelable {
mVideoState = videoState;
mConnectTimeMillis = connectTimeMillis;
mStatusHints = statusHints;
+ mExtras = extras;
}
@Override
@@ -110,6 +114,10 @@ public final class ParcelableConference implements Parcelable {
return mStatusHints;
}
+ public Bundle getExtras() {
+ return mExtras;
+ }
+
public static final Parcelable.Creator<ParcelableConference> CREATOR =
new Parcelable.Creator<ParcelableConference> () {
@Override
@@ -125,9 +133,10 @@ public final class ParcelableConference implements Parcelable {
IVideoProvider.Stub.asInterface(source.readStrongBinder());
int videoState = source.readInt();
StatusHints statusHints = source.readParcelable(classLoader);
+ Bundle extras = source.readBundle(classLoader);
return new ParcelableConference(phoneAccount, state, capabilities, connectionIds,
- videoCallProvider, videoState, connectTimeMillis, statusHints);
+ videoCallProvider, videoState, connectTimeMillis, statusHints, extras);
}
@Override
@@ -154,5 +163,6 @@ public final class ParcelableConference implements Parcelable {
mVideoProvider != null ? mVideoProvider.asBinder() : null);
destination.writeInt(mVideoState);
destination.writeParcelable(mStatusHints, 0);
+ destination.writeBundle(mExtras);
}
}
diff --git a/telecomm/java/android/telecom/ParcelableConnection.java b/telecomm/java/android/telecom/ParcelableConnection.java
index 552e250..683ab6a 100644
--- a/telecomm/java/android/telecom/ParcelableConnection.java
+++ b/telecomm/java/android/telecom/ParcelableConnection.java
@@ -17,6 +17,7 @@
package android.telecom;
import android.net.Uri;
+import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@@ -46,6 +47,7 @@ public final class ParcelableConnection implements Parcelable {
private final StatusHints mStatusHints;
private final DisconnectCause mDisconnectCause;
private final List<String> mConferenceableConnectionIds;
+ private final Bundle mExtras;
/** @hide */
public ParcelableConnection(
@@ -62,7 +64,8 @@ public final class ParcelableConnection implements Parcelable {
boolean isVoipAudioMode,
StatusHints statusHints,
DisconnectCause disconnectCause,
- List<String> conferenceableConnectionIds) {
+ List<String> conferenceableConnectionIds,
+ Bundle extras) {
mPhoneAccount = phoneAccount;
mState = state;
mConnectionCapabilities = capabilities;
@@ -76,7 +79,8 @@ public final class ParcelableConnection implements Parcelable {
mIsVoipAudioMode = isVoipAudioMode;
mStatusHints = statusHints;
mDisconnectCause = disconnectCause;
- this.mConferenceableConnectionIds = conferenceableConnectionIds;
+ mConferenceableConnectionIds = conferenceableConnectionIds;
+ mExtras = extras;
}
public PhoneAccountHandle getPhoneAccount() {
@@ -136,15 +140,21 @@ public final class ParcelableConnection implements Parcelable {
return mConferenceableConnectionIds;
}
+ public final Bundle getExtras() {
+ return mExtras;
+ }
+
@Override
public String toString() {
return new StringBuilder()
.append("ParcelableConnection [act:")
.append(mPhoneAccount)
- .append(", state:")
+ .append("], state:")
.append(mState)
.append(", capabilities:")
.append(Connection.capabilitiesToString(mConnectionCapabilities))
+ .append(", extras:")
+ .append(mExtras)
.toString();
}
@@ -170,6 +180,7 @@ public final class ParcelableConnection implements Parcelable {
DisconnectCause disconnectCause = source.readParcelable(classLoader);
List<String> conferenceableConnectionIds = new ArrayList<>();
source.readStringList(conferenceableConnectionIds);
+ Bundle extras = source.readBundle(classLoader);
return new ParcelableConnection(
phoneAccount,
@@ -185,7 +196,8 @@ public final class ParcelableConnection implements Parcelable {
audioModeIsVoip,
statusHints,
disconnectCause,
- conferenceableConnectionIds);
+ conferenceableConnectionIds,
+ extras);
}
@Override
@@ -218,5 +230,6 @@ public final class ParcelableConnection implements Parcelable {
destination.writeParcelable(mStatusHints, 0);
destination.writeParcelable(mDisconnectCause, 0);
destination.writeStringList(mConferenceableConnectionIds);
+ destination.writeBundle(mExtras);
}
}
diff --git a/telecomm/java/android/telecom/RemoteConference.java b/telecomm/java/android/telecom/RemoteConference.java
index 095a88f..c2261c3 100644
--- a/telecomm/java/android/telecom/RemoteConference.java
+++ b/telecomm/java/android/telecom/RemoteConference.java
@@ -18,7 +18,9 @@ package android.telecom;
import com.android.internal.telecom.IConnectionService;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
+import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
@@ -49,6 +51,7 @@ public final class RemoteConference {
RemoteConference conference,
List<RemoteConnection> conferenceableConnections) {}
public void onDestroyed(RemoteConference conference) {}
+ public void onExtrasChanged(RemoteConference conference, @Nullable Bundle extras) {}
}
private final String mId;
@@ -65,6 +68,7 @@ public final class RemoteConference {
private int mState = Connection.STATE_NEW;
private DisconnectCause mDisconnectCause;
private int mConnectionCapabilities;
+ private Bundle mExtras;
/** @hide */
RemoteConference(String id, IConnectionService connectionService) {
@@ -209,6 +213,21 @@ public final class RemoteConference {
}
}
+ /** @hide */
+ void setExtras(final Bundle extras) {
+ mExtras = extras;
+ for (CallbackRecord<Callback> record : mCallbackRecords) {
+ final RemoteConference conference = this;
+ final Callback callback = record.getCallback();
+ record.getHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ callback.onExtrasChanged(conference, extras);
+ }
+ });
+ }
+ }
+
/**
* Returns the list of {@link RemoteConnection}s contained in this conference.
*
@@ -238,6 +257,15 @@ public final class RemoteConference {
}
/**
+ * Obtain the extras associated with this {@code RemoteConnection}.
+ *
+ * @return The extras for this connection.
+ */
+ public final Bundle getExtras() {
+ return mExtras;
+ }
+
+ /**
* Disconnects the conference call as well as the child {@link RemoteConnection}s.
*/
public void disconnect() {
diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java
index 1d6e15c..d62c08e 100644
--- a/telecomm/java/android/telecom/RemoteConnection.java
+++ b/telecomm/java/android/telecom/RemoteConnection.java
@@ -20,8 +20,10 @@ import com.android.internal.telecom.IConnectionService;
import com.android.internal.telecom.IVideoCallback;
import com.android.internal.telecom.IVideoProvider;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.net.Uri;
+import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
@@ -150,7 +152,6 @@ public final class RemoteConnection {
*
* @param connection The {@code RemoteConnection} invoking this method.
* @param videoState The new video state of the {@code RemoteConnection}.
- * @hide
*/
public void onVideoStateChanged(RemoteConnection connection, int videoState) {}
@@ -181,7 +182,6 @@ public final class RemoteConnection {
* @param connection The {@code RemoteConnection} invoking this method.
* @param videoProvider The new {@code VideoProvider} associated with this
* {@code RemoteConnection}.
- * @hide
*/
public void onVideoProviderChanged(
RemoteConnection connection, VideoProvider videoProvider) {}
@@ -197,23 +197,30 @@ public final class RemoteConnection {
public void onConferenceChanged(
RemoteConnection connection,
RemoteConference conference) {}
+
+ /**
+ * Handles changes to the {@code RemoteConference} extras.
+ *
+ * @param connection The {@code RemoteConnection} invoking this method.
+ * @param extras The extras containing other information associated with the connection.
+ */
+ public void onExtrasChanged(RemoteConnection connection, @Nullable Bundle extras) {}
}
- /** {@hide} */
public static class VideoProvider {
- public abstract static class Listener {
- public void onReceiveSessionModifyRequest(
+ public abstract static class Callback {
+ public void onSessionModifyRequestReceived(
VideoProvider videoProvider,
VideoProfile videoProfile) {}
- public void onReceiveSessionModifyResponse(
+ public void onSessionModifyResponseReceived(
VideoProvider videoProvider,
int status,
VideoProfile requestedProfile,
VideoProfile responseProfile) {}
- public void onHandleCallSessionEvent(VideoProvider videoProvider, int event) {}
+ public void onCallSessionEvent(VideoProvider videoProvider, int event) {}
public void onPeerDimensionsChanged(VideoProvider videoProvider, int width, int height) {}
@@ -229,16 +236,16 @@ public final class RemoteConnection {
private final IVideoCallback mVideoCallbackDelegate = new IVideoCallback() {
@Override
public void receiveSessionModifyRequest(VideoProfile videoProfile) {
- for (Listener l : mListeners) {
- l.onReceiveSessionModifyRequest(VideoProvider.this, videoProfile);
+ for (Callback l : mCallbacks) {
+ l.onSessionModifyRequestReceived(VideoProvider.this, videoProfile);
}
}
@Override
public void receiveSessionModifyResponse(int status, VideoProfile requestedProfile,
VideoProfile responseProfile) {
- for (Listener l : mListeners) {
- l.onReceiveSessionModifyResponse(
+ for (Callback l : mCallbacks) {
+ l.onSessionModifyResponseReceived(
VideoProvider.this,
status,
requestedProfile,
@@ -248,21 +255,21 @@ public final class RemoteConnection {
@Override
public void handleCallSessionEvent(int event) {
- for (Listener l : mListeners) {
- l.onHandleCallSessionEvent(VideoProvider.this, event);
+ for (Callback l : mCallbacks) {
+ l.onCallSessionEvent(VideoProvider.this, event);
}
}
@Override
public void changePeerDimensions(int width, int height) {
- for (Listener l : mListeners) {
+ for (Callback l : mCallbacks) {
l.onPeerDimensionsChanged(VideoProvider.this, width, height);
}
}
@Override
public void changeCallDataUsage(long dataUsage) {
- for (Listener l : mListeners) {
+ for (Callback l : mCallbacks) {
l.onCallDataUsageChanged(VideoProvider.this, dataUsage);
}
}
@@ -270,14 +277,14 @@ public final class RemoteConnection {
@Override
public void changeCameraCapabilities(
VideoProfile.CameraCapabilities cameraCapabilities) {
- for (Listener l : mListeners) {
+ for (Callback l : mCallbacks) {
l.onCameraCapabilitiesChanged(VideoProvider.this, cameraCapabilities);
}
}
@Override
public void changeVideoQuality(int videoQuality) {
- for (Listener l : mListeners) {
+ for (Callback l : mCallbacks) {
l.onVideoQualityChanged(VideoProvider.this, videoQuality);
}
}
@@ -298,10 +305,10 @@ public final class RemoteConnection {
* load factor before resizing, 1 means we only expect a single thread to
* access the map so make only a single shard
*/
- private final Set<Listener> mListeners = Collections.newSetFromMap(
- new ConcurrentHashMap<Listener, Boolean>(8, 0.9f, 1));
+ private final Set<Callback> mCallbacks = Collections.newSetFromMap(
+ new ConcurrentHashMap<Callback, Boolean>(8, 0.9f, 1));
- public VideoProvider(IVideoProvider videoProviderBinder) {
+ VideoProvider(IVideoProvider videoProviderBinder) {
mVideoProviderBinder = videoProviderBinder;
try {
mVideoProviderBinder.addVideoCallback(mVideoCallbackServant.getStub().asBinder());
@@ -309,12 +316,12 @@ public final class RemoteConnection {
}
}
- public void addListener(Listener l) {
- mListeners.add(l);
+ public void registerCallback(Callback l) {
+ mCallbacks.add(l);
}
- public void removeListener(Listener l) {
- mListeners.remove(l);
+ public void unregisterCallback(Callback l) {
+ mCallbacks.remove(l);
}
public void setCamera(String cameraId) {
@@ -415,6 +422,7 @@ public final class RemoteConnection {
private String mCallerDisplayName;
private int mCallerDisplayNamePresentation;
private RemoteConference mConference;
+ private Bundle mExtras;
/**
* @hide
@@ -597,8 +605,7 @@ public final class RemoteConnection {
/**
* Obtains the video state of this {@code RemoteConnection}.
*
- * @return The video state of the {@code RemoteConnection}. See {@link VideoProfile.VideoState}.
- * @hide
+ * @return The video state of the {@code RemoteConnection}. See {@link VideoProfile}.
*/
public int getVideoState() {
return mVideoState;
@@ -607,20 +614,28 @@ public final class RemoteConnection {
/**
* Obtains the video provider of this {@code RemoteConnection}.
* @return The video provider associated with this {@code RemoteConnection}.
- * @hide
*/
public final VideoProvider getVideoProvider() {
return mVideoProvider;
}
/**
+ * Obtain the extras associated with this {@code RemoteConnection}.
+ *
+ * @return The extras for this connection.
+ */
+ public final Bundle getExtras() {
+ return mExtras;
+ }
+
+ /**
* 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.
*/
public boolean isRingbackRequested() {
- return false;
+ return mRingbackRequested;
}
/**
@@ -1097,6 +1112,21 @@ public final class RemoteConnection {
}
}
+ /** @hide */
+ void setExtras(final Bundle extras) {
+ mExtras = extras;
+ for (CallbackRecord record : mCallbackRecords) {
+ final RemoteConnection connection = this;
+ final Callback callback = record.getCallback();
+ record.getHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ callback.onExtrasChanged(connection, extras);
+ }
+ });
+ }
+ }
+
/**
* Create a RemoteConnection represents a failure, and which will be in
* {@link Connection#STATE_DISCONNECTED}. Attempting to use it for anything will almost
diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java
index 0208744..dc0de0c 100644
--- a/telecomm/java/android/telecom/RemoteConnectionService.java
+++ b/telecomm/java/android/telecom/RemoteConnectionService.java
@@ -17,6 +17,7 @@
package android.telecom;
import android.net.Uri;
+import android.os.Bundle;
import android.os.IBinder;
import android.os.IBinder.DeathRecipient;
import android.os.RemoteException;
@@ -318,6 +319,17 @@ final class RemoteConnectionService {
mOurConnectionServiceImpl.addRemoteExistingConnection(remoteConnction);
}
+
+ @Override
+ public void setExtras(String callId, Bundle extras) {
+ if (mConnectionById.containsKey(callId)) {
+ findConnectionForAction(callId, "setExtras")
+ .setExtras(extras);
+ } else {
+ findConferenceForAction(callId, "setExtras")
+ .setExtras(extras);
+ }
+ }
};
private final ConnectionServiceAdapterServant mServant =
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 145c993..fb0ecb0 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -69,9 +69,7 @@ public class TelecomManager {
/**
* The {@link android.content.Intent} action used to configure a
* {@link android.telecom.ConnectionService}.
- * @hide
*/
- @SystemApi
public static final String ACTION_CONNECTION_SERVICE_CONFIGURE =
"android.telecom.action.CONNECTION_SERVICE_CONFIGURE";
@@ -126,23 +124,6 @@ public class TelecomManager {
"android.telecom.action.CHANGE_DEFAULT_DIALER";
/**
- * Activity action: Opens the settings screen where a user can enable and disable which
- * {@link PhoneAccount}s are allows to make and receive calls. Because a user must
- * explicitly enable an account before the system will use it, an app may want to send the
- * user to this setting after registering a {@link PhoneAccount}.
- * <p>
- * Input: get*Extra field {@link #EXTRA_PHONE_ACCOUNT_DESCRIPTION} contains a string-based
- * reference to the {@link PhoneAccountHandle} you want to enable. get*Extra field
- * {@link #EXTRA_ENABLE_PHONE_ACCOUNT_VALUE} contains a boolean value indicated whether
- * the account should be enabled or disabled.
- * <p>
- * Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE}
- * @hide
- */
- public static final String ACTION_ENABLE_PHONE_ACCOUNT_SETTING =
- "android.telecom.action.ENABLE_PHONE_ACCOUNT_SETTING";
-
- /**
* Extra value used to provide the package name for {@link #ACTION_CHANGE_DEFAULT_DIALER}.
*/
public static final String EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME =
@@ -178,23 +159,11 @@ public class TelecomManager {
"android.telecom.extra.PHONE_ACCOUNT_HANDLE";
/**
- * The extra used with {@link #ACTION_ENABLE_PHONE_ACCOUNT_SETTING} to specify a phone account
- * as a string value. The value is of the form: "A;B" where A is the component name of the
- * {@link PhoneAccount} (e.g.,
- * com.android.phone/com.android.services.telephony.TelephonyConnectionService) and B is the
- * {@link PhoneAccount} ID.
- * @hide
- */
- public static final String EXTRA_PHONE_ACCOUNT_DESCRIPTION =
- "android.telecom.extra.PHONE_ACCOUNT_DESCRIPTION";
-
- /**
- * Boolean extra used to specify a value for enabling and disabling a phone account.
- * Used with {@link #ACTION_ENABLE_PHONE_ACCOUNT_SETTING}.
- * @hide
+ * The extra used by a {@link ConnectionService} to provide the handle of the caller that
+ * has initiated a new incoming call.
*/
- public static final String EXTRA_ENABLE_PHONE_ACCOUNT_VALUE =
- "android.telecom.extra.ENABLE_PHONE_ACCOUNT_VALUE";
+ public static final String EXTRA_INCOMING_CALL_HANDLE =
+ "android.telecom.extra.INCOMING_CALL_HANDLE";
/**
* Optional extra for {@link #ACTION_INCOMING_CALL} containing a {@link Bundle} which contains
diff --git a/telecomm/java/android/telecom/VideoProfile.java b/telecomm/java/android/telecom/VideoProfile.java
index 71de505..11a4976 100644
--- a/telecomm/java/android/telecom/VideoProfile.java
+++ b/telecomm/java/android/telecom/VideoProfile.java
@@ -173,7 +173,7 @@ public class VideoProfile implements Parcelable {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[VideoProfile videoState = ");
- sb.append(VideoState.videoStateToString(mVideoState));
+ sb.append(videoStateToString(mVideoState));
sb.append(" videoQuality = ");
sb.append(mQuality);
sb.append("]");
@@ -181,142 +181,106 @@ public class VideoProfile implements Parcelable {
}
/**
- * The video state of the call, stored as a bit-field describing whether video transmission and
- * receipt it enabled, as well as whether the video is currently muted.
- */
- public static class VideoState {
- /**
- * Call is currently in an audio-only mode with no video transmission or receipt.
- * @deprecated Use {@link VideoProfile#STATE_AUDIO_ONLY} instead
- * @hide
- */
- public static final int AUDIO_ONLY = VideoProfile.STATE_AUDIO_ONLY;
-
- /**
- * Video transmission is enabled.
- * @deprecated Use {@link VideoProfile#STATE_TX_ENABLED} instead
- * @hide
- */
- public static final int TX_ENABLED = VideoProfile.STATE_TX_ENABLED;
-
- /**
- * Video reception is enabled.
- * @deprecated Use {@link VideoProfile#STATE_RX_ENABLED} instead
- * @hide
- */
- public static final int RX_ENABLED = VideoProfile.STATE_RX_ENABLED;
-
- /**
- * Video signal is bi-directional.
- * @deprecated Use {@link VideoProfile#STATE_BIDIRECTIONAL} instead
- * @hide
- */
- public static final int BIDIRECTIONAL = VideoProfile.STATE_BIDIRECTIONAL;
-
- /**
- * Video is paused.
- * @deprecated Use {@link VideoProfile#STATE_PAUSED} instead
- * @hide
- */
- public static final int PAUSED = VideoProfile.STATE_PAUSED;
-
- /** @hide */
- private VideoState() {}
-
- /**
- * Whether the video state is audio only.
- * @param videoState The video state.
- * @return Returns true if the video state is audio only.
- */
- public static boolean isAudioOnly(int videoState) {
- return !hasState(videoState, VideoProfile.STATE_TX_ENABLED)
- && !hasState(videoState, VideoProfile.STATE_RX_ENABLED);
- }
+ * Generates a string representation of a video state.
+ *
+ * @param videoState The video state.
+ * @return String representation of the video state.
+ */
+ public static String videoStateToString(int videoState) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Audio");
- /**
- * Whether the video state is any of the video type
- * @param videoState The video state.
- * @hide
- * @return Returns true if the video state TX or RX or Bidirectional
- */
- public static boolean isVideo(int videoState) {
- return hasState(videoState, VideoProfile.STATE_TX_ENABLED)
- || hasState(videoState, VideoProfile.STATE_RX_ENABLED)
- || hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL);
- }
+ if (isAudioOnly(videoState)) {
+ sb.append(" Only");
+ } else {
+ if (isTransmissionEnabled(videoState)) {
+ sb.append(" Tx");
+ }
- /**
- * Whether the video transmission is enabled.
- * @param videoState The video state.
- * @return Returns true if the video transmission is enabled.
- */
- public static boolean isTransmissionEnabled(int videoState) {
- return hasState(videoState, VideoProfile.STATE_TX_ENABLED);
- }
+ if (isReceptionEnabled(videoState)) {
+ sb.append(" Rx");
+ }
- /**
- * Whether the video reception is enabled.
- * @param videoState The video state.
- * @return Returns true if the video transmission is enabled.
- */
- public static boolean isReceptionEnabled(int videoState) {
- return hasState(videoState, VideoProfile.STATE_RX_ENABLED);
+ if (isPaused(videoState)) {
+ sb.append(" Pause");
+ }
}
- /**
- * Whether the video signal is bi-directional.
- * @param videoState
- * @return Returns true if the video signal is bi-directional.
- */
- public static boolean isBidirectional(int videoState) {
- return hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL);
- }
+ return sb.toString();
+ }
- /**
- * Whether the video is paused.
- * @param videoState The video state.
- * @return Returns true if the video is paused.
- */
- public static boolean isPaused(int videoState) {
- return hasState(videoState, VideoProfile.STATE_PAUSED);
- }
+ /**
+ * Indicates whether the video state is audio only.
+ *
+ * @param videoState The video state.
+ * @return {@code True} if the video state is audio only, {@code false} otherwise.
+ */
+ public static boolean isAudioOnly(int videoState) {
+ return !hasState(videoState, VideoProfile.STATE_TX_ENABLED)
+ && !hasState(videoState, VideoProfile.STATE_RX_ENABLED);
+ }
- /**
- * Determines if a specified state is set in a videoState bit-mask.
- *
- * @param videoState The video state bit-mask.
- * @param state The state to check.
- * @return {@code True} if the state is set.
- * {@hide}
- */
- private static boolean hasState(int videoState, int state) {
- return (videoState & state) == state;
- }
+ /**
+ * Indicates whether video transmission or reception is enabled for a video state.
+ *
+ * @param videoState The video state.
+ * @return {@code True} if video transmission or reception is enabled, {@code false} otherwise.
+ */
+ public static boolean isVideo(int videoState) {
+ return hasState(videoState, VideoProfile.STATE_TX_ENABLED)
+ || hasState(videoState, VideoProfile.STATE_RX_ENABLED)
+ || hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL);
+ }
- /**
- * Generates a string representation of a {@link VideoState}.
- *
- * @param videoState The video state.
- * @return String representation of the {@link VideoState}.
- */
- public static String videoStateToString(int videoState) {
- StringBuilder sb = new StringBuilder();
- sb.append("Audio");
+ /**
+ * Indicates whether the video state has video transmission enabled.
+ *
+ * @param videoState The video state.
+ * @return {@code True} if video transmission is enabled, {@code false} otherwise.
+ */
+ public static boolean isTransmissionEnabled(int videoState) {
+ return hasState(videoState, VideoProfile.STATE_TX_ENABLED);
+ }
- if (VideoProfile.VideoState.isTransmissionEnabled(videoState)) {
- sb.append(" Tx");
- }
+ /**
+ * Indicates whether the video state has video reception enabled.
+ *
+ * @param videoState The video state.
+ * @return {@code True} if video reception is enabled, {@code false} otherwise.
+ */
+ public static boolean isReceptionEnabled(int videoState) {
+ return hasState(videoState, VideoProfile.STATE_RX_ENABLED);
+ }
- if (VideoProfile.VideoState.isReceptionEnabled(videoState)) {
- sb.append(" Rx");
- }
+ /**
+ * Indicates whether the video state is bi-directional.
+ *
+ * @param videoState The video state.
+ * @return {@code True} if the video is bi-directional, {@code false} otherwise.
+ */
+ public static boolean isBidirectional(int videoState) {
+ return hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL);
+ }
- if (VideoProfile.VideoState.isPaused(videoState)) {
- sb.append(" Pause");
- }
+ /**
+ * Indicates whether the video state is paused.
+ *
+ * @param videoState The video state.
+ * @return {@code True} if the video is paused, {@code false} otherwise.
+ */
+ public static boolean isPaused(int videoState) {
+ return hasState(videoState, VideoProfile.STATE_PAUSED);
+ }
- return sb.toString();
- }
+ /**
+ * Indicates if a specified state is set in a videoState bit-mask.
+ *
+ * @param videoState The video state bit-mask.
+ * @param state The state to check.
+ * @return {@code True} if the state is set.
+ */
+ private static boolean hasState(int videoState, int state) {
+ return (videoState & state) == state;
}
/**
diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
index 67e2edb..7647444 100644
--- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
@@ -18,6 +18,7 @@ package com.android.internal.telecom;
import android.app.PendingIntent;
import android.net.Uri;
+import android.os.Bundle;
import android.telecom.ConnectionRequest;
import android.telecom.DisconnectCause;
import android.telecom.ParcelableConnection;
@@ -83,4 +84,6 @@ oneway interface IConnectionServiceAdapter {
void setConferenceableConnections(String callId, in List<String> conferenceableCallIds);
void addExistingConnection(String callId, in ParcelableConnection connection);
+
+ void setExtras(String callId, in Bundle extras);
}
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index aa02021..ea6a74a 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -231,5 +231,10 @@ interface ITelecomService {
/**
* @see TelecomServiceImpl#enablePhoneAccount
*/
- void enablePhoneAccount(in PhoneAccountHandle accountHandle, boolean isEnabled);
+ boolean enablePhoneAccount(in PhoneAccountHandle accountHandle, boolean isEnabled);
+
+ /**
+ * @see TelecomServiceImpl#setDefaultDialer
+ */
+ boolean setDefaultDialer(in String packageName);
}