hal: fix no audio issue in voice call
No audio is observed in voice call -> voip -> voice call scenario
since voice usecase is incorrectly stopped when audio mode
MODE_IN_COMMUNICATION is set. This results in not setting the voice
usecase if when the usecase transitions from voip -> voice.
Fix by removing check for MODE_IN_COMMUNICATION in adev_set_mode().
Also update the check for selecting voice devices in select_devices()
to ensure that voice devices are still selected in
voice call -> voip -> voice call scenario.
CRs-Fixed: 966076
Change-Id: I3566705f745247075d6f12b625fcf929970ff507
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index f610096..ae7853e 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -959,7 +959,7 @@
* usecase. This is to avoid switching devices for voice call when
* check_usecases_codec_backend() is called below.
*/
- if (voice_is_in_call(adev) && adev->mode == AUDIO_MODE_IN_CALL) {
+ if (voice_is_in_call(adev) && adev->mode != AUDIO_MODE_NORMAL) {
vc_usecase = get_usecase_from_list(adev,
get_usecase_id_from_usecase_type(adev, VOICE_CALL));
if ((vc_usecase) && ((vc_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) ||
@@ -3607,8 +3607,7 @@
if (adev->mode != mode) {
ALOGD("%s: mode %d\n", __func__, mode);
adev->mode = mode;
- if ((mode == AUDIO_MODE_NORMAL || mode == AUDIO_MODE_IN_COMMUNICATION) &&
- voice_is_in_call(adev)) {
+ if ((mode == AUDIO_MODE_NORMAL) && voice_is_in_call(adev)) {
voice_stop_call(adev);
platform_set_gsm_mode(adev->platform, false);
adev->current_call_output = NULL;