Fix routing for wired headset
Bug: 8239898
Change-Id: Id001206b2e5aa441340b38d62fbcee7449cf5cba
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index b3d236f..d5ed155 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -370,6 +370,9 @@
} else if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADSET |
AUDIO_DEVICE_OUT_SPEAKER)) {
snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES;
+ } else if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADSET |
+ AUDIO_DEVICE_OUT_WIRED_HEADPHONE)) {
+ snd_device = SND_DEVICE_OUT_HEADPHONES;
} else if (devices == (AUDIO_DEVICE_OUT_AUX_DIGITAL |
AUDIO_DEVICE_OUT_SPEAKER)) {
snd_device = SND_DEVICE_OUT_SPEAKER_AND_HDMI;
@@ -381,6 +384,18 @@
goto exit;
}
}
+
+ if (popcount(devices) == 3) {
+ if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
+ AUDIO_DEVICE_OUT_WIRED_HEADSET |
+ AUDIO_DEVICE_OUT_SPEAKER)) {
+ snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES;
+ } else {
+ ALOGE("%s: Invalid combo device(0x%x)", __func__, devices);
+ }
+ goto exit;
+ }
+
if (popcount(devices) != 1) {
ALOGE("%s: Invalid output devices(0x%x)", __func__, devices);
goto exit;