hal: fix output device selection when start voice call
When primary output device is set to A2DP, voice usecase
will select BT_A2DP for output device. This is not valid
device for voice call.
Fix it by add A2DP check to avoid voice call start at A2DP.
CRs-Fixed: 2227493
Change-Id: Iad5bda633f7ff2c456ae1a7b015845b37c5e1c39
diff --git a/hal/voice.c b/hal/voice.c
index 0a48a05..70bb7e1 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -226,16 +226,17 @@
goto error_start_voice;
}
- uc_info->in_snd_device = SND_DEVICE_NONE;
- uc_info->out_snd_device = SND_DEVICE_NONE;
-
- if (audio_is_bluetooth_sco_device(uc_info->devices) && !adev->bt_sco_on) {
- ALOGE("start_call: couldn't find BT SCO, SCO is not ready");
+ if ((audio_is_bluetooth_sco_device(uc_info->devices) && !adev->bt_sco_on) ||
+ audio_is_a2dp_out_device(uc_info->devices)) {
+ ALOGE("start_call: BT SCO is chosen but SCO is not ready, or A2DP is selected");
adev->voice.in_call = false;
ret = -EIO;
goto error_start_voice;
}
+ uc_info->in_snd_device = SND_DEVICE_NONE;
+ uc_info->out_snd_device = SND_DEVICE_NONE;
+
list_add_tail(&adev->usecase_list, &uc_info->list);
select_devices(adev, usecase_id);