summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJasmine Cha <chajasmine@google.com>2019-08-21 11:08:46 +0800
committerJasmine Cha <chajasmine@google.com>2019-08-21 20:58:51 +0800
commit7b07bdeb2a79c99e2201521be3fc72cd883deddc (patch)
treefe131379bc71b2d6ab70c5cfb54ab212ad09f8bc
parent47893b63fe11b9df23dc1af0520d4b442eb7cfe8 (diff)
downloadandroid_hardware_knowles_athletico_sound_trigger_hal-7b07bdeb2a79c99e2201521be3fc72cd883deddc.tar.gz
android_hardware_knowles_athletico_sound_trigger_hal-7b07bdeb2a79c99e2201521be3fc72cd883deddc.tar.bz2
android_hardware_knowles_athletico_sound_trigger_hal-7b07bdeb2a79c99e2201521be3fc72cd883deddc.zip
sthal: handle audio record case during voice/voip stopped
- If recording is running between stop voice/voip usecase and set mode 0, inactive sequence of recording will not close voice/voip mode completely. - Add one flag to close voice/voip mode indeed Bug: 139670493 Test: issue sequece, Voice/VoIP call on hs/bt Change-Id: I2598947f064c82f07e3d48d71cfef45033c1687a Signed-off-by: Jasmine Cha <chajasmine@google.com>
-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: