OSDN Git Service

Fix "invalid device combination" in system audio mode.
authorJungshik Jang <jayjang@google.com>
Fri, 5 Sep 2014 12:25:48 +0000 (21:25 +0900)
committerJungshik Jang <jayjang@google.com>
Fri, 5 Sep 2014 12:25:48 +0000 (21:25 +0900)
HDMI-CEC system audio mode removes speaker from output
list. It also has multiple outputs by connected outputs.
However, getDeviceForVolume() doesn't cover multiple
output with no speaker or bluetooth case.
This change picks one of system audio outputs in order.

Bug: 17400026
Change-Id: I102fd0052c9c4c9543f9e8f3b16ec6815d7485d8

services/audiopolicy/AudioPolicyManager.cpp

index a805923..084c853 100644 (file)
@@ -4634,8 +4634,15 @@ audio_devices_t AudioPolicyManager::getDeviceForVolume(audio_devices_t device)
         //  - one A2DP device + another device: happens with duplicated output. In this case
         // retain the device on the A2DP output as the other must not correspond to an active
         // selection if not the speaker.
+        //  - HDMI-CEC system audio mode only output: give priority to available item in order.
         if (device & AUDIO_DEVICE_OUT_SPEAKER) {
             device = AUDIO_DEVICE_OUT_SPEAKER;
+        } else if (device & AUDIO_DEVICE_OUT_HDMI_ARC) {
+            device = AUDIO_DEVICE_OUT_HDMI_ARC;
+        } else if (device & AUDIO_DEVICE_OUT_AUX_LINE) {
+            device = AUDIO_DEVICE_OUT_AUX_LINE;
+        } else if (device & AUDIO_DEVICE_OUT_SPDIF) {
+            device = AUDIO_DEVICE_OUT_SPDIF;
         } else {
             device = (audio_devices_t)(device & AUDIO_DEVICE_OUT_ALL_A2DP);
         }