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 f5f32107dd.

Change-Id: I7044e54d5a8a95bf8cebe2e8198f51f2be1ea35c
This commit is contained in:
Zhou Song 2021-06-10 15:18:05 +08:00
parent 9f94d0ffad
commit 1963438c17
3 changed files with 13 additions and 4 deletions

View File

@ -561,7 +561,7 @@ void audio_extn_sound_trigger_update_device_status(snd_device_t snd_device,
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) &&

View File

@ -204,7 +204,7 @@ int voice_stop_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
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 @@ int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
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 @@ int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
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 @@ bool voice_is_in_call_rec_stream(const struct stream_in *in)
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 voice_stop_call(struct audio_device *adev)
{
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 @@ void voice_init(struct audio_device *adev)
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;

View File

@ -62,6 +62,7 @@ struct voice {
float volume;
bool in_call;
bool lte_call;
bool uc_active;
};
struct power_mode_cfg {
@ -93,6 +94,7 @@ void voice_init(struct audio_device *adev);
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);