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
diff --git a/api/current.txt b/api/current.txt
index 8541495..2b52021 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -30587,6 +30587,13 @@
     method public int describeContents();
     method public int getQuality();
     method public int getVideoState();
+    method public static boolean isAudioOnly(int);
+    method public static boolean isBidirectional(int);
+    method public static boolean isPaused(int);
+    method public static boolean isReceptionEnabled(int);
+    method public static boolean isTransmissionEnabled(int);
+    method public static boolean isVideo(int);
+    method public static java.lang.String videoStateToString(int);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile> CREATOR;
     field public static final int QUALITY_DEFAULT = 4; // 0x4
@@ -30609,15 +30616,6 @@
     field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile.CameraCapabilities> CREATOR;
   }
 
-  public static class VideoProfile.VideoState {
-    method public static boolean isAudioOnly(int);
-    method public static boolean isBidirectional(int);
-    method public static boolean isPaused(int);
-    method public static boolean isReceptionEnabled(int);
-    method public static boolean isTransmissionEnabled(int);
-    method public static java.lang.String videoStateToString(int);
-  }
-
 }
 
 package android.telephony {
diff --git a/api/system-current.txt b/api/system-current.txt
index fb7376c..45984c0 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -32800,6 +32800,13 @@
     method public int describeContents();
     method public int getQuality();
     method public int getVideoState();
+    method public static boolean isAudioOnly(int);
+    method public static boolean isBidirectional(int);
+    method public static boolean isPaused(int);
+    method public static boolean isReceptionEnabled(int);
+    method public static boolean isTransmissionEnabled(int);
+    method public static boolean isVideo(int);
+    method public static java.lang.String videoStateToString(int);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile> CREATOR;
     field public static final int QUALITY_DEFAULT = 4; // 0x4
@@ -32822,15 +32829,6 @@
     field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile.CameraCapabilities> CREATOR;
   }
 
-  public static class VideoProfile.VideoState {
-    method public static boolean isAudioOnly(int);
-    method public static boolean isBidirectional(int);
-    method public static boolean isPaused(int);
-    method public static boolean isReceptionEnabled(int);
-    method public static boolean isTransmissionEnabled(int);
-    method public static java.lang.String videoStateToString(int);
-  }
-
 }
 
 package android.telephony {
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 @@
      * 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 @@
      * 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 @@
             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 @@
     /**
      * 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 @@
     /**
      * 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..11a49767 100644
--- a/telecomm/java/android/telecom/VideoProfile.java
+++ b/telecomm/java/android/telecom/VideoProfile.java
@@ -173,7 +173,7 @@
     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 @@
     }
 
     /**
-    * 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;
+     * 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");
 
-        /**
-         * 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);
-        }
-
-        /**
-         * 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);
-        }
-
-        /**
-         * 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);
-        }
-
-        /**
-         * 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);
-        }
-
-        /**
-         * 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);
-        }
-
-        /**
-         * 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);
-        }
-
-        /**
-         * 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;
-        }
-
-        /**
-         * 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");
-
-            if (VideoProfile.VideoState.isTransmissionEnabled(videoState)) {
+        if (isAudioOnly(videoState)) {
+            sb.append(" Only");
+        } else {
+            if (isTransmissionEnabled(videoState)) {
                 sb.append(" Tx");
             }
 
-            if (VideoProfile.VideoState.isReceptionEnabled(videoState)) {
+            if (isReceptionEnabled(videoState)) {
                 sb.append(" Rx");
             }
 
-            if (VideoProfile.VideoState.isPaused(videoState)) {
+            if (isPaused(videoState)) {
                 sb.append(" Pause");
             }
-
-            return sb.toString();
         }
+
+        return sb.toString();
+    }
+
+    /**
+     * 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);
+    }
+
+    /**
+     * 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);
+    }
+
+    /**
+     * 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);
+    }
+
+    /**
+     * 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);
+    }
+
+    /**
+     * 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);
+    }
+
+    /**
+     * 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);
+    }
+
+    /**
+     * 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/telephony/java/com/android/ims/ImsCallProfile.java b/telephony/java/com/android/ims/ImsCallProfile.java
index 604d32d..1c69794 100644
--- a/telephony/java/com/android/ims/ImsCallProfile.java
+++ b/telephony/java/com/android/ims/ImsCallProfile.java
@@ -313,28 +313,28 @@
      * @return The video state.
      */
     public static int getVideoStateFromImsCallProfile(ImsCallProfile callProfile) {
-        int videostate = VideoProfile.VideoState.AUDIO_ONLY;
+        int videostate = VideoProfile.STATE_AUDIO_ONLY;
         switch (callProfile.mCallType) {
             case CALL_TYPE_VT_TX:
-                videostate = VideoProfile.VideoState.TX_ENABLED;
+                videostate = VideoProfile.STATE_TX_ENABLED;
                 break;
             case CALL_TYPE_VT_RX:
-                videostate = VideoProfile.VideoState.RX_ENABLED;
+                videostate = VideoProfile.STATE_RX_ENABLED;
                 break;
             case CALL_TYPE_VT:
-                videostate = VideoProfile.VideoState.BIDIRECTIONAL;
+                videostate = VideoProfile.STATE_BIDIRECTIONAL;
                 break;
             case CALL_TYPE_VOICE:
-                videostate = VideoProfile.VideoState.AUDIO_ONLY;
+                videostate = VideoProfile.STATE_AUDIO_ONLY;
                 break;
             default:
-                videostate = VideoProfile.VideoState.AUDIO_ONLY;
+                videostate = VideoProfile.STATE_AUDIO_ONLY;
                 break;
         }
-        if (callProfile.isVideoPaused() && videostate != VideoProfile.VideoState.AUDIO_ONLY) {
-            videostate |= VideoProfile.VideoState.PAUSED;
+        if (callProfile.isVideoPaused() && videostate != VideoProfile.STATE_AUDIO_ONLY) {
+            videostate |= VideoProfile.STATE_PAUSED;
         } else {
-            videostate &= ~VideoProfile.VideoState.PAUSED;
+            videostate &= ~VideoProfile.STATE_PAUSED;
         }
         return videostate;
     }
@@ -347,9 +347,9 @@
      * @return The call type.
      */
     public static int getCallTypeFromVideoState(int videoState) {
-        boolean videoTx = isVideoStateSet(videoState, VideoProfile.VideoState.TX_ENABLED);
-        boolean videoRx = isVideoStateSet(videoState, VideoProfile.VideoState.RX_ENABLED);
-        boolean isPaused = isVideoStateSet(videoState, VideoProfile.VideoState.PAUSED);
+        boolean videoTx = isVideoStateSet(videoState, VideoProfile.STATE_TX_ENABLED);
+        boolean videoRx = isVideoStateSet(videoState, VideoProfile.STATE_RX_ENABLED);
+        boolean isPaused = isVideoStateSet(videoState, VideoProfile.STATE_PAUSED);
         if (isPaused) {
             return ImsCallProfile.CALL_TYPE_VT_NODIR;
         } else if (videoTx && !videoRx) {