hal: add standalone flag to report event to sthal
Add a new flag to indicate that if there is an active
voice call ongoing, then correct usecase type can be
populated before reporting concurrency event to sthal.
This also reverts f5f32107dd0a423c89385ee2310c1565d49ce69d.
Change-Id: I7044e54d5a8a95bf8cebe2e8198f51f2be1ea35c
diff --git a/hal/audio_extn/soundtrigger.c b/hal/audio_extn/soundtrigger.c
index b3df579..d7bbb2f 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_in_call(st_dev->adev)) {
+ if (voice_is_uc_active(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) &&
diff --git a/hal/voice.c b/hal/voice.c
index 230ceed..e2218e6 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -204,7 +204,7 @@
disable_snd_device(adev, uc_info->in_snd_device);
adev->voice.lte_call = false;
- adev->voice.in_call = false;
+ adev->voice.uc_active = false;
list_remove(&uc_info->list);
free(uc_info);
@@ -245,7 +245,7 @@
return -ENOMEM;
}
- adev->voice.in_call = true;
+ adev->voice.uc_active = true;
uc_info->id = usecase_id;
uc_info->type = VOICE_CALL;
@@ -256,6 +256,7 @@
if (is_in_call && list_length(&uc_info->device_list) == 2) {
ALOGE("%s: Invalid combo device(%#x) for voice call", __func__,
get_device_types(&uc_info->device_list));
+ adev->voice.in_call = false;
ret = -EIO;
goto error_start_voice;
}
@@ -457,6 +458,11 @@
return in_call_rec;
}
+bool voice_is_uc_active(const struct audio_device *adev)
+{
+ return adev->voice.uc_active;
+}
+
uint32_t voice_get_active_session_id(struct audio_device *adev)
{
int ret = 0;
@@ -727,12 +733,12 @@
{
int ret = 0;
+ adev->voice.in_call = false;
ret = voice_extn_stop_call(adev);
if (ret == -ENOSYS) {
ret = voice_stop_usecase(adev, USECASE_VOICE_CALL);
}
- adev->voice.in_call = false;
return ret;
}
@@ -838,6 +844,7 @@
adev->voice.mic_mute = false;
adev->voice.in_call = false;
adev->voice.lte_call = false;
+ adev->voice.uc_active = false;
for (i = 0; i < max_voice_sessions; i++) {
adev->voice.session[i].pcm_rx = NULL;
adev->voice.session[i].pcm_tx = NULL;
diff --git a/hal/voice.h b/hal/voice.h
index 290ca3d..da456f9 100644
--- a/hal/voice.h
+++ b/hal/voice.h
@@ -62,6 +62,7 @@
float volume;
bool in_call;
bool lte_call;
+ bool uc_active;
};
struct power_mode_cfg {
@@ -93,6 +94,7 @@
bool voice_is_in_call(const struct audio_device *adev);
bool voice_is_in_call_or_call_screen(const struct audio_device *adev);
bool voice_is_in_call_rec_stream(const struct stream_in *in);
+bool voice_is_uc_active(const struct audio_device *adev);
int voice_set_mic_mute(struct audio_device *dev, bool state);
bool voice_is_lte_call_active(struct audio_device *adev);
bool voice_get_mic_mute(struct audio_device *dev);