[DO NOT MERGE] Add "acceptRingingCall()" API which accepts a videoState.

- Added acceptRingingCall API which accepts a videostate to complement the
existing API.

Bug: 20159300
Change-Id: I2a9d53fd4dbbb0be49d95416f7e26d3ec61774cd
diff --git a/api/system-current.txt b/api/system-current.txt
index 1df4861..c91a967 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -32707,6 +32707,7 @@
 
   public class TelecomManager {
     method public void acceptRingingCall();
+    method public void acceptRingingCall(int);
     method public void addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle);
     method public void addNewUnknownCall(android.telecom.PhoneAccountHandle, android.os.Bundle);
     method public void cancelMissedCallsNotification();
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index b07b018f..4916a66 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -1024,7 +1024,9 @@
      * If there is a ringing incoming call, this method accepts the call on behalf of the user.
      * TODO: L-release - need to convert all invocation of ITelecmmService#answerRingingCall to use
      * this method (clockwork & gearhead).
-     *
+     * If the incoming call is a video call, the call will be answered with the same video state as
+     * the incoming call requests.  This means, for example, that an incoming call requesting
+     * {@link VideoProfile#STATE_BIDIRECTIONAL} will be answered, accepting that state.
      * @hide
      */
     @SystemApi
@@ -1039,6 +1041,24 @@
     }
 
     /**
+     * If there is a ringing incoming call, this method accepts the call on behalf of the user,
+     * with the specified video state.
+     *
+     * @param videoState The desired video state to answer the call with.
+     * @hide
+     */
+    @SystemApi
+    public void acceptRingingCall(int videoState) {
+        try {
+            if (isServiceConnected()) {
+                getTelecomService().acceptRingingCallWithVideoState(videoState);
+            }
+        } catch (RemoteException e) {
+            Log.e(TAG, "Error calling ITelecomService#acceptRingingCallWithVideoState", e);
+        }
+    }
+
+    /**
      * Silences the ringer if a ringing call exists.
      */
     public void silenceRinger() {
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index 2e07759..856e210 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -178,6 +178,11 @@
     void acceptRingingCall();
 
     /**
+     * @see TelecomServiceImpl#acceptRingingCallWithVideoState(int)
+     */
+    void acceptRingingCallWithVideoState(int videoState);
+
+    /**
      * @see TelecomServiceImpl#cancelMissedCallsNotification
      */
     void cancelMissedCallsNotification(String callingPackage);