Merge "[Call Screening]Programmatically changing the default call screening app."
diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java
index 1ba23a5..b02804d 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -961,6 +961,12 @@
         updateCall(call);
     }
 
+    @Override
+    public void onIsVoipAudioModeChanged(Call call) {
+        Log.d(this, "onIsVoipAudioModeChanged %s", call);
+        updateCall(call);
+    }
+
     void bringToForeground(boolean showDialpad) {
         if (!mInCallServices.isEmpty()) {
             for (IInCallService inCallService : mInCallServices.values()) {
diff --git a/src/com/android/server/telecom/ParcelableCallUtils.java b/src/com/android/server/telecom/ParcelableCallUtils.java
index 80a8b5a..7eb8f0e 100644
--- a/src/com/android/server/telecom/ParcelableCallUtils.java
+++ b/src/com/android/server/telecom/ParcelableCallUtils.java
@@ -102,6 +102,10 @@
             properties |= android.telecom.Call.Details.PROPERTY_ENTERPRISE_CALL;
         }
 
+        if (call.getIsVoipAudioMode()) {
+            properties |= android.telecom.Call.Details.PROPERTY_VOIP_AUDIO_MODE;
+        }
+
         // If this is a single-SIM device, the "default SIM" will always be the only SIM.
         boolean isDefaultSmsAccount = phoneAccountRegistrar != null &&
                 phoneAccountRegistrar.isUserSelectedSmsPhoneAccount(call.getTargetPhoneAccount());
diff --git a/tests/src/com/android/server/telecom/tests/InCallServiceFixture.java b/tests/src/com/android/server/telecom/tests/InCallServiceFixture.java
index 69fcdd8..d114cb8 100644
--- a/tests/src/com/android/server/telecom/tests/InCallServiceFixture.java
+++ b/tests/src/com/android/server/telecom/tests/InCallServiceFixture.java
@@ -76,7 +76,11 @@
         @Override
         public void updateCall(ParcelableCall call) throws RemoteException {
             if (!mCallById.containsKey(call.getId())) {
-                throw new RuntimeException("Call " + call.getId() + " not added yet");
+                // This used to throw an exception, however the actual InCallService implementation
+                // ignores updates for calls which don't yet exist.  This is not a problem as when
+                // a call is added to an InCallService its entire state is parceled and sent to the
+                // InCallService.
+                return;
             }
             mLatestCallId = call.getId();
             mCallById.put(call.getId(), call);
diff --git a/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java b/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
index 25110e8..282a74e 100644
--- a/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
+++ b/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
@@ -388,8 +388,8 @@
 
         IInCallAdapter inCallAdapter = mInCallServiceFixtureX.getInCallAdapter();
         inCallAdapter.conference(callId1.mCallId, callId2.mCallId);
-        // Wait for wacky non-deterministic behavior
-        Thread.sleep(200);
+        // Wait for the handler in ConnectionService
+        waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT);
         ParcelableCall call1 = mInCallServiceFixtureX.getCall(callId1.mCallId);
         ParcelableCall call2 = mInCallServiceFixtureX.getCall(callId2.mCallId);
         // Check that the two calls end up with a parent in the end