audio hal: fix enabling snd device with same backend on the codec twice.
Enable hearing-aid-mic and handset-mic at the same time will cause codec crash
during voice call.
Route afe-proxy-record usecase to hearing-aid-mic device when it uses
handset-mic device.
Bug: 139555903
Test: MO and MT voice call with hearing aid.
Change-Id: I2d536ff1e75d7848208fa0f6a726715f522eeb6c
Signed-off-by: juyuchen <juyuchen@google.com>
(cherry picked from commit af6a1d3e707f62462facedee54964df0a3911134)
Signed-off-by: Aniket Kumar Lata <alata@codeaurora.org>
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 7a2c2b9..9636572 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1764,13 +1764,13 @@
if (usecase->type != PCM_PLAYBACK &&
usecase != uc_info &&
(usecase->in_snd_device != snd_device || force_routing) &&
- ((uc_info->devices & backend_check_cond) &&
+ (((uc_info->devices & backend_check_cond) &&
(((usecase->devices & ~AUDIO_DEVICE_BIT_IN) & AUDIO_DEVICE_IN_ALL_CODEC_BACKEND) ||
- (usecase->type == VOIP_CALL))) &&
+ (usecase->type == VOIP_CALL))) ||
((uc_info->type == VOICE_CALL &&
usecase->devices == AUDIO_DEVICE_IN_VOICE_CALL) ||
platform_check_backends_match(snd_device,\
- usecase->in_snd_device)) &&
+ usecase->in_snd_device))) &&
(usecase->id != USECASE_AUDIO_SPKR_CALIB_TX)) {
ALOGV("%s: Usecase (%s) is active on (%s) - disabling ..",
__func__, use_case_table[usecase->id],