IMS-VT: Update pause video capabilities for conference call
Update pause video capabilities for conference call if
pausing outgoing video is supported on host connection

Test: Manual
Bug: 35035756
Change-Id: I8fc5867831a5562cf8ddeeaee15e6f7954adb7f9
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index e33c351..e924b0d 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -330,6 +330,10 @@
                 Connection.CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO,
                 can(capabilities, Connection.CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO));
 
+        conferenceCapabilities = changeBitmask(conferenceCapabilities,
+                Connection.CAPABILITY_CAN_PAUSE_VIDEO,
+                mConferenceHost.getVideoPauseSupported() && isVideoCapable());
+
         return conferenceCapabilities;
     }
 
@@ -940,6 +944,16 @@
         }
     }
 
+    /**
+     * Determines if the host of this conference is capable of video calling.
+     * @return {@code true} if video capable, {@code false} otherwise.
+     */
+    private boolean isVideoCapable() {
+        int capabilities = mConferenceHost.getConnectionCapabilities();
+        return can(capabilities, Connection.CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL)
+                && can(capabilities, Connection.CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL);
+    }
+
     private void updateStatusHints() {
         if (mConferenceHost == null) {
             setStatusHints(null);
diff --git a/src/com/android/services/telephony/ImsConferenceController.java b/src/com/android/services/telephony/ImsConferenceController.java
index 6669482..d151693 100644
--- a/src/com/android/services/telephony/ImsConferenceController.java
+++ b/src/com/android/services/telephony/ImsConferenceController.java
@@ -331,6 +331,7 @@
         // This is necessary since the Connection Service does not support removing a connection
         // from Telecom.  Instead we create a new instance and remove the old one from telecom.
         TelephonyConnection conferenceHostConnection = connection.cloneConnection();
+        conferenceHostConnection.setVideoPauseSupported(connection.getVideoPauseSupported());
 
         PhoneAccountHandle phoneAccountHandle = null;
 
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index ef2b414..62343b9 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -1549,6 +1549,14 @@
     }
 
     /**
+     * @return {@code true} if this connection supports pausing the outgoing video using the
+     * {@link android.telecom.VideoProfile#STATE_PAUSED} VideoState.
+     */
+    public boolean getVideoPauseSupported() {
+        return mIsVideoPauseSupported;
+    }
+
+    /**
      * Sets whether this connection supports conference calling.
      * @param isConferenceSupported {@code true} if conference calling is supported by this
      *                                         connection, {@code false} otherwise.