AudioPolicyManager: only modify surround formats for HDMI devices

USB devices were getting modified by mistake.

Bug: 27938796
Change-Id: Ib62f6df804f8e578a702aba93439ff7cbfe3347a
Signed-off-by: Phil Burk <philburk@google.com>
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index d25dabd..2405ced 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -3678,7 +3678,7 @@
                     mpClientInterface->setParameters(output, String8(param));
                     free(param);
                 }
-                updateAudioProfiles(output, profile->getAudioProfiles());
+                updateAudioProfiles(device, output, profile->getAudioProfiles());
                 if (!profile->hasValidAudioProfile()) {
                     ALOGW("checkOutputsForDevice() missing param");
                     mpClientInterface->closeOutput(output);
@@ -3916,7 +3916,7 @@
                     mpClientInterface->setParameters(input, String8(param));
                     free(param);
                 }
-                updateAudioProfiles(input, profile->getAudioProfiles());
+                updateAudioProfiles(device, input, profile->getAudioProfiles());
                 if (!profile->hasValidAudioProfile()) {
                     ALOGW("checkInputsForDevice() direct input missing param");
                     mpClientInterface->closeInput(input);
@@ -5306,7 +5306,8 @@
             __FUNCTION__, supportsAC3, supportsOtherSurround, supportsIEC61937);
 }
 
-void AudioPolicyManager::updateAudioProfiles(audio_io_handle_t ioHandle,
+void AudioPolicyManager::updateAudioProfiles(audio_devices_t device,
+                                             audio_io_handle_t ioHandle,
                                              AudioProfileVector &profiles)
 {
     String8 reply;
@@ -5323,7 +5324,9 @@
             return;
         }
         FormatVector formats = formatsFromString(reply.string());
-        filterSurroundFormats(formats);
+        if (device == AUDIO_DEVICE_OUT_HDMI) {
+            filterSurroundFormats(formats);
+        }
         profiles.setFormats(formats);
     }
     const FormatVector &supportedFormats = profiles.getSupportedFormats();