DO NOT MERGE Add ability to specify video state through TestInCallService intent.

TestInCallService has an "ACTION_SEND_UPGRADE_REQUEST_FROM_TEST_INCALL_SERVICE"
intent.
Added support to specify an int videoState as part of the intent so that
the caller can test sending video requests that our InCall may not
support (e.g. incoming 1-way request when in audio-only).

Bug: 20090022
Change-Id: I283575cc296444bbdadcdec5c1caa1593c1eed3b
diff --git a/testapps/AndroidManifest.xml b/testapps/AndroidManifest.xml
index 231bff6..bbe0243 100644
--- a/testapps/AndroidManifest.xml
+++ b/testapps/AndroidManifest.xml
@@ -59,6 +59,7 @@
                  android:process="com.android.server.telecom.testapps.TestInCallService" >
             <intent-filter>
                 <action android:name="android.server.telecom.testapps.ACTION_SEND_UPDATE_REQUEST_FROM_TEST_INCALL_SERVICE"/>
+                <data android:scheme="int" />
             </intent-filter>
         </receiver>
 
@@ -86,10 +87,6 @@
                 <category android:name="android.intent.category.DEFAULT" />
                 <data android:scheme="int" />
             </intent-filter>
-            <intent-filter>
-                <action android:name="android.server.telecom.testapps.ACTION_SEND_UPDATE_REQUEST_FROM_TEST_INCALL_SERVICE" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
         </activity>
 
         <receiver android:name="com.android.server.telecom.testapps.CallNotificationReceiver"
diff --git a/testapps/src/com/android/server/telecom/testapps/TestCallList.java b/testapps/src/com/android/server/telecom/testapps/TestCallList.java
index dabc21b..98ad0ab 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestCallList.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestCallList.java
@@ -129,8 +129,8 @@
     /**
      * For any video calls tracked, sends an upgrade to video request.
      */
-    public void sendUpgradeToVideoRequest() {
-        Log.v(TAG, "sendUpgradeToVideoRequest "+mCalls.size()+ " " + System.identityHashCode(this));
+    public void sendUpgradeToVideoRequest(int videoState) {
+        Log.v(TAG, "sendUpgradeToVideoRequest : videoState = " + videoState);
 
         for (Call call : mCalls) {
             InCallService.VideoCall videoCall = call.getVideoCall();
@@ -140,8 +140,7 @@
             }
 
             Log.v(TAG, "send upgrade to video request for call: " + call);
-            videoCall.sendSessionModifyRequest(new VideoProfile(
-                    VideoProfile.VideoState.BIDIRECTIONAL));
+            videoCall.sendSessionModifyRequest(new VideoProfile(videoState));
         }
     }
 
diff --git a/testapps/src/com/android/server/telecom/testapps/TestInCallServiceBroadcastReceiver.java b/testapps/src/com/android/server/telecom/testapps/TestInCallServiceBroadcastReceiver.java
index efef45c..790c9eb 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestInCallServiceBroadcastReceiver.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestInCallServiceBroadcastReceiver.java
@@ -45,7 +45,8 @@
         Log.v(TAG, "onReceive: " + action);
 
         if (ACTION_SEND_UPDATE_REQUEST_FROM_TEST_INCALL_SERVICE.equals(action)) {
-            TestCallList.getInstance().sendUpgradeToVideoRequest();
+            final int videoState = Integer.parseInt(intent.getData().getSchemeSpecificPart());
+            TestCallList.getInstance().sendUpgradeToVideoRequest(videoState);
         }
     }
 }