hal: fix voice call device routing issue
adev->voice_device_set flag is to indicate voice call
device routing update from policymanager to HAL. It is
set to true in voice_start_call and reset in update_calls()
which causes mismatch in flag update during back to back
voice calls scenario. Update adev->voice_device_set flag
in voice_stop_call instead of update_calls(). Rename
voice_device_set flag to in_call for readability.
Change-Id: Ie07105671f254899890bdb4c0635c7dc1f55dbff
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 87ea0d3..66c50e8 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -670,7 +670,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)) {
+ if (adev->voice.in_call && adev->mode == AUDIO_MODE_IN_CALL) {
vc_usecase = get_usecase_from_list(adev,
get_voice_usecase_id_from_list(adev));
if ((vc_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) ||
@@ -1628,17 +1628,18 @@
select_devices(adev, out->usecase);
if ((adev->mode == AUDIO_MODE_IN_CALL) &&
- !voice_is_in_call(adev) &&
- (out == adev->primary_output)) {
+ !adev->voice.in_call &&
+ (out == adev->primary_output)) {
ret = voice_start_call(adev);
- } else if (voice_is_in_call(adev) &&
- (out == adev->primary_output)) {
+ } else if ((adev->mode == AUDIO_MODE_IN_CALL) &&
+ adev->voice.in_call &&
+ (out == adev->primary_output)) {
voice_update_devices_for_all_voice_usecases(adev);
}
}
if ((adev->mode == AUDIO_MODE_NORMAL) &&
- voice_is_in_call(adev) &&
+ adev->voice.in_call &&
(out == adev->primary_output)) {
ret = voice_stop_call(adev);
}