From 87b73f370e2b8a76b0540580f43edba6ec21c6cf Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Wed, 3 Jun 2015 10:09:59 -0700 Subject: API Cleanup: Remove VideoState class. - Remove VideoState class. - Replace references to VideoState constants with VideoProfile equivalent. - Push VideoState static methods into VideoProfile. Bug: 21573551 Change-Id: I1bca02772b5b7d86643f612824b07faef7618725 --- telecomm/java/android/telecom/Conference.java | 2 +- telecomm/java/android/telecom/Connection.java | 2 +- .../java/android/telecom/ConnectionRequest.java | 2 +- .../android/telecom/ConnectionServiceAdapter.java | 8 +- .../java/android/telecom/RemoteConnection.java | 2 +- telecomm/java/android/telecom/VideoProfile.java | 214 +++++++++------------ 6 files changed, 97 insertions(+), 133 deletions(-) (limited to 'telecomm/java/android') diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index b18feb5..77fdb65 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -206,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; } /** diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index e2bbc62..bb210f1 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -1608,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/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java index 1cb042c..4ab9ee5 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java @@ -342,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. diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java index 52c60e6..d62c08e 100644 --- a/telecomm/java/android/telecom/RemoteConnection.java +++ b/telecomm/java/android/telecom/RemoteConnection.java @@ -605,7 +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}. + * @return The video state of the {@code RemoteConnection}. See {@link VideoProfile}. */ public int getVideoState() { return mVideoState; 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; } /** -- cgit v1.1