Cleanup of Video Call pause functionality.

Whether the paused videoState is available is dependent on the carrier's
implementation of the VT spec. The original VT implementation assumed
that this was stored in a system property accessed via InCall; these CLs
move this to a Call/Connection capability which will ultimately support
multisim video capable devices.

- Added mapping between Connection/Call capability.
- Changed toString for VideoState in a Call so that it is easier to see
the video state of a call in the logs.

Bug: 16680364
Bug: 19820114
Change-Id: I3840f92270100811161120dffcfe297bef7c4ea2
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index d20fdf5..e4476bb 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -416,18 +416,48 @@
             component = mConnectionService.getComponentName().flattenToShortString();
         }
 
-        return String.format(Locale.US, "[%s, %s, %s, %s, %d, childs(%d), has_parent(%b), [%s], %d]",
+
+
+        return String.format(Locale.US, "[%s, %s, %s, %s, %s, childs(%d), has_parent(%b), [%s], %d]",
                 System.identityHashCode(this),
                 CallState.toString(mState),
                 component,
                 Log.piiHandle(mHandle),
-                getVideoState(),
+                getVideoStateDescription(getVideoState()),
                 getChildCalls().size(),
                 getParentCall() != null,
                 Connection.capabilitiesToString(getConnectionCapabilities()),
                 getCallSubstate());
     }
 
+    /**
+     * Builds a debug-friendly description string for a video state.
+     * <p>
+     * A = audio active, T = video transmission active, R = video reception active, P = video
+     * paused.
+     *
+     * @param videoState The video state.
+     * @return A string indicating which bits are set in the video state.
+     */
+    private String getVideoStateDescription(int videoState) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("A");
+
+        if (VideoProfile.VideoState.isTransmissionEnabled(videoState)) {
+            sb.append("T");
+        }
+
+        if (VideoProfile.VideoState.isReceptionEnabled(videoState)) {
+            sb.append("R");
+        }
+
+        if (VideoProfile.VideoState.isPaused(videoState)) {
+            sb.append("P");
+        }
+
+        return sb.toString();
+    }
+
     int getState() {
         return mState;
     }
diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java
index 5d06ddc..17e9e37 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -624,7 +624,10 @@
         android.telecom.Call.Details.CAPABILITY_SHOW_CALLBACK_NUMBER,
 
         Connection.CAPABILITY_CAN_UPGRADE_TO_VIDEO,
-        android.telecom.Call.Details.CAPABILITY_CAN_UPGRADE_TO_VIDEO
+        android.telecom.Call.Details.CAPABILITY_CAN_UPGRADE_TO_VIDEO,
+
+        Connection.CAPABILITY_CAN_PAUSE_VIDEO,
+        android.telecom.Call.Details.CAPABILITY_CAN_PAUSE_VIDEO
     };
 
     private static int convertConnectionToCallCapabilities(int connectionCapabilities) {