summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJasmine Cha <chajasmine@google.com>2019-08-21 09:37:39 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-08-21 09:37:39 -0700
commitc7fcc7ddf1215a3587175d5028423d562c8fd1ee (patch)
treefe131379bc71b2d6ab70c5cfb54ab212ad09f8bc
parent8576f06e18d5d28e9a26f021de54b5be12a77d2b (diff)
parent7b07bdeb2a79c99e2201521be3fc72cd883deddc (diff)
downloadandroid_hardware_knowles_athletico_sound_trigger_hal-c7fcc7ddf1215a3587175d5028423d562c8fd1ee.tar.gz
android_hardware_knowles_athletico_sound_trigger_hal-c7fcc7ddf1215a3587175d5028423d562c8fd1ee.tar.bz2
android_hardware_knowles_athletico_sound_trigger_hal-c7fcc7ddf1215a3587175d5028423d562c8fd1ee.zip
sthal: handle audio record case during voice/voip stopped
am: 7b07bdeb2a Change-Id: I8ec61abaa20c00e7b67ba0d54aa67ca4e9bdf856
-rw-r--r--sound_trigger_hw_iaxxx.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/sound_trigger_hw_iaxxx.c b/sound_trigger_hw_iaxxx.c
index 268f14d..61712dd 100644
--- a/sound_trigger_hw_iaxxx.c
+++ b/sound_trigger_hw_iaxxx.c
@@ -180,6 +180,7 @@ struct knowles_sound_trigger_device {
bool is_con_mic_route_enabled;
bool is_in_voice_voip_mode;
bool is_voice_voip_stop;
+ bool is_voice_voip_start;
unsigned int current_enable;
unsigned int recover_model_list;
@@ -3410,6 +3411,7 @@ static int stdev_open(const hw_module_t *module, const char *name,
stdev->is_con_mic_route_enabled = false;
stdev->is_in_voice_voip_mode = false;
stdev->is_voice_voip_stop = false;
+ stdev->is_voice_voip_start = false;
stdev->is_music_playing = false;
stdev->is_bargein_route_enabled = false;
stdev->is_chre_loaded = false;
@@ -3517,21 +3519,27 @@ int sound_trigger_hw_call_back(audio_event_type_t event,
// get previous mode
pre_mode = get_sthal_mode(stdev);
+ // get correct voice/voip mode in sthal
if (stdev->is_in_voice_voip_mode == false &&
stdev->is_voice_voip_stop == true &&
stdev->is_media_recording == true) {
ALOGD("%s: voice/voip didn't start, treat it as media recording inactive", __func__);
stdev->is_voice_voip_stop = false;
stdev->is_media_recording = false;
- }
-
- // update conditions
- if (stdev->is_voice_voip_stop == true) {
+ } else if (stdev->is_voice_voip_stop == true) {
ALOGD("%s: voice/voip device is inactive",
__func__);
stdev->is_in_voice_voip_mode = false;
stdev->is_voice_voip_stop = false;
+ } else if (stdev->is_in_voice_voip_mode == true &&
+ stdev->is_voice_voip_stop == false &&
+ stdev->is_voice_voip_start == false) {
+ ALOGD("%s: voice/voip usecase didn't start in incall mode, treat it as voice/voip is inactive",
+ __func__);
+ stdev->is_in_voice_voip_mode = false;
}
+
+ // check mic concurrency condition
if (stdev->is_concurrent_capture == true &&
stdev->is_in_voice_voip_mode == false) {
if (stdev->is_media_recording == true)
@@ -3557,10 +3565,12 @@ int sound_trigger_hw_call_back(audio_event_type_t event,
__func__, event, config->u.usecase.type);
// update conditions
- if ((config->u.usecase.type == USECASE_TYPE_VOICE_CALL ||
- config->u.usecase.type == USECASE_TYPE_VOIP_CALL))
+ if (stdev->is_voice_voip_start == true &&
+ (config->u.usecase.type == USECASE_TYPE_VOICE_CALL ||
+ config->u.usecase.type == USECASE_TYPE_VOIP_CALL)) {
stdev->is_voice_voip_stop = true;
- else if (config->u.usecase.type == USECASE_TYPE_PCM_CAPTURE)
+ stdev->is_voice_voip_start = false;
+ } else if (config->u.usecase.type == USECASE_TYPE_PCM_CAPTURE)
stdev->is_media_recording = false;
break;
@@ -3580,7 +3590,7 @@ int sound_trigger_hw_call_back(audio_event_type_t event,
__func__);
stdev->is_in_voice_voip_mode = true;
}
- if (config->u.usecase.type == USECASE_TYPE_PCM_CAPTURE ) {
+ if (config->u.usecase.type == USECASE_TYPE_PCM_CAPTURE) {
stdev->is_media_recording = true;
}
if (stdev->is_concurrent_capture == true &&
@@ -3600,6 +3610,10 @@ int sound_trigger_hw_call_back(audio_event_type_t event,
case AUDIO_EVENT_CAPTURE_STREAM_ACTIVE:
ALOGD("%s: handle capture stream active event %d, usecase :%d",
__func__, event, config->u.usecase.type);
+ if (config->u.usecase.type == USECASE_TYPE_VOICE_CALL ||
+ config->u.usecase.type == USECASE_TYPE_VOIP_CALL) {
+ stdev->is_voice_voip_start = true;
+ }
break;
case AUDIO_EVENT_PLAYBACK_STREAM_INACTIVE: