hal: ensure voip tx update base on the rx path
Voip does not use primary output in rx path. When voip
rx device change, voip tx path is not updated accordingly.
Fix it by selecting voip tx device base on the rx path,
otherwise base on primary output device.
CRs-Fixed: 2289517
Change-Id: Ic078eb057be40dd4338ade70f541bb056c19dfca
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 9283115..2753ff8 100755
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -4490,6 +4490,16 @@
(mode == AUDIO_MODE_IN_COMMUNICATION)) {
if (out_device & AUDIO_DEVICE_OUT_SPEAKER)
in_device = AUDIO_DEVICE_IN_BACK_MIC;
+ else if (out_device & AUDIO_DEVICE_OUT_EARPIECE)
+ in_device = AUDIO_DEVICE_IN_BUILTIN_MIC;
+ else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET)
+ in_device = AUDIO_DEVICE_IN_WIRED_HEADSET;
+ else if (out_device & AUDIO_DEVICE_OUT_USB_DEVICE)
+ in_device = AUDIO_DEVICE_IN_USB_DEVICE;
+
+ in_device = ((out_device == AUDIO_DEVICE_NONE) ?
+ AUDIO_DEVICE_IN_BUILTIN_MIC : in_device) & ~AUDIO_DEVICE_BIT_IN;
+
if (adev->active_input) {
snd_device = get_snd_device_for_voice_comm(my_data, out_device, in_device);
}