alsa_sound: change input device for communication
Match to VOIP speaker device pair with voice call. In voice call using
speakerphone, we want to use BACK_MIC for input.
Bug: 7329372
Change-Id: I9c42719f17e2be6f0b38292dc74ac3ce54767b64
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/alsa_sound/alsa_default.cpp b/alsa_sound/alsa_default.cpp
index 40d575c..316921d 100644
--- a/alsa_sound/alsa_default.cpp
+++ b/alsa_sound/alsa_default.cpp
@@ -409,6 +409,11 @@
} else if (devices & AudioSystem::DEVICE_IN_BUILTIN_MIC) {
if (mode == AudioSystem::MODE_IN_CALL) {
devices |= AudioSystem::DEVICE_OUT_EARPIECE;
+ } else if (mode == AudioSystem::MODE_IN_COMMUNICATION) {
+ if (!strncmp(curRxUCMDevice, SND_USE_CASE_DEV_SPEAKER, MAX_LEN(curRxUCMDevice, SND_USE_CASE_DEV_SPEAKER))) {
+ devices &= ~AudioSystem::DEVICE_IN_BUILTIN_MIC;
+ devices |= AudioSystem::DEVICE_IN_BACK_MIC;
+ }
}
} else if (devices & AudioSystem::DEVICE_OUT_EARPIECE) {
devices = devices | AudioSystem::DEVICE_IN_BUILTIN_MIC;