voice: fix incorrect usecase type reported to sthal
To ensure correct usecase type can be reported to sthal
when staring voice call, set the call state early
before reporting device event to sthal, and reset the
call flag after event reported.
Change-Id: I5f7bc0ffefc49d9c706c9067eba5df4e84702ec9
diff --git a/hal/audio_extn/soundtrigger.c b/hal/audio_extn/soundtrigger.c
index 330c9cb..b3df579 100644
--- a/hal/audio_extn/soundtrigger.c
+++ b/hal/audio_extn/soundtrigger.c
@@ -561,7 +561,7 @@
struct stream_in *active_input = adev_get_active_input(st_dev->adev);
audio_source_t source = (active_input == NULL) ?
AUDIO_SOURCE_DEFAULT : active_input->source;
- if (voice_is_call_state_active_in_call(st_dev->adev)) {
+ if (voice_is_in_call(st_dev->adev)) {
ev_info.u.usecase.type = USECASE_TYPE_VOICE_CALL;
} else if ((st_dev->adev->mode == AUDIO_MODE_IN_COMMUNICATION ||
source == AUDIO_SOURCE_VOICE_COMMUNICATION) &&