diff options
| author | Kunlei Zhang <kunleiz@codeaurora.org> | 2019-06-25 15:42:21 +0800 |
|---|---|---|
| committer | Kunlei Zhang <kunleiz@codeaurora.org> | 2019-07-14 12:04:26 +0800 |
| commit | fb485071e8527dfa802bdd09aaa5485623d145e0 (patch) | |
| tree | 62337944fa96b09b22aca2af5427c047591ceb6b | |
| parent | 4451a4dd415bf5886b7f5459d260b0cc4d7ce868 (diff) | |
| download | hardware_qcom_audio-fb485071e8527dfa802bdd09aaa5485623d145e0.tar.gz hardware_qcom_audio-fb485071e8527dfa802bdd09aaa5485623d145e0.tar.bz2 hardware_qcom_audio-fb485071e8527dfa802bdd09aaa5485623d145e0.zip | |
hal: fix voip device selection is not proper after voice call stop
In voip+voice concurrency case, when voip resume after voice call stop,
voip device still uses voice devices. This is due to in_call flag isn't
reset even if voice usecase doesn't exist.
Fix it by adding function to check voice usecase existence and get
correct device for non-voice usecases.
Change-Id: I39ba1092a0ab19c686baa1b80bb9913f64849590
| -rw-r--r-- | hal/msm8916/platform.c | 16 | ||||
| -rw-r--r-- | hal/msm8974/platform.c | 16 | ||||
| -rw-r--r-- | hal/voice.c | 16 | ||||
| -rw-r--r-- | hal/voice.h | 1 |
4 files changed, 37 insertions, 12 deletions
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c index fb443698..7bc508d5 100644 --- a/hal/msm8916/platform.c +++ b/hal/msm8916/platform.c @@ -4112,7 +4112,7 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o * enforced audible (e.g. Camera shutter sound). */ if ((mode == AUDIO_MODE_IN_CALL) || - voice_is_in_call(adev) || + voice_check_voicecall_usecases_active(adev) || voice_extn_compress_voip_is_active(adev)) is_active_voice_call = true; @@ -4195,7 +4195,7 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o } if ((mode == AUDIO_MODE_IN_CALL) || - voice_is_in_call(adev) || + voice_check_voicecall_usecases_active(adev) || voice_extn_compress_voip_is_active(adev)) { if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || devices & AUDIO_DEVICE_OUT_WIRED_HEADSET || @@ -4571,8 +4571,10 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d ALOGV("%s: enter: out_device(%#x) in_device(%#x) channel_count (%d) channel_mask (0x%x)", __func__, out_device, in_device, channel_count, channel_mask); if (my_data->external_mic) { - if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) || voice_is_in_call(adev) || - voice_extn_compress_voip_is_active(adev) || audio_extn_hfp_is_active(adev))) { + if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) || + voice_check_voicecall_usecases_active(adev) || + voice_extn_compress_voip_is_active(adev) || + audio_extn_hfp_is_active(adev))) { if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || out_device & AUDIO_DEVICE_OUT_EARPIECE || out_device & AUDIO_DEVICE_OUT_SPEAKER ) @@ -4586,8 +4588,10 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d if (snd_device != AUDIO_DEVICE_NONE) goto exit; - if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) || voice_is_in_call(adev) || - voice_extn_compress_voip_is_active(adev) || audio_extn_hfp_is_active(adev))) { + if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) || + voice_check_voicecall_usecases_active(adev) || + voice_extn_compress_voip_is_active(adev) || + audio_extn_hfp_is_active(adev))) { if ((adev->voice.tty_mode != TTY_MODE_OFF) && !voice_extn_compress_voip_is_active(adev)) { if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index 0931d421..263dc1a7 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -4074,7 +4074,7 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o * enforced audible (e.g. Camera shutter sound). */ if ((mode == AUDIO_MODE_IN_CALL) || - voice_is_in_call(adev) || + voice_check_voicecall_usecases_active(adev) || voice_extn_compress_voip_is_active(adev)) is_active_voice_call = true; @@ -4159,7 +4159,7 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o } if ((mode == AUDIO_MODE_IN_CALL) || - voice_is_in_call(adev) || + voice_check_voicecall_usecases_active(adev) || voice_extn_compress_voip_is_active(adev)) { if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || devices & AUDIO_DEVICE_OUT_WIRED_HEADSET || @@ -4547,8 +4547,10 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d ALOGV("%s: enter: out_device(%#x) in_device(%#x) channel_count (%d) channel_mask (0x%x)", __func__, out_device, in_device, channel_count, channel_mask); if (my_data->external_mic) { - if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) || voice_is_in_call(adev) || - voice_extn_compress_voip_is_active(adev) || audio_extn_hfp_is_active(adev))) { + if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) || + voice_check_voicecall_usecases_active(adev) || + voice_extn_compress_voip_is_active(adev) || + audio_extn_hfp_is_active(adev))) { if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || out_device & AUDIO_DEVICE_OUT_EARPIECE || out_device & AUDIO_DEVICE_OUT_SPEAKER ) @@ -4562,8 +4564,10 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d if (snd_device != AUDIO_DEVICE_NONE) goto exit; - if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) || voice_is_in_call(adev) || - voice_extn_compress_voip_is_active(adev) || audio_extn_hfp_is_active(adev))) { + if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) || + voice_check_voicecall_usecases_active(adev) || + voice_extn_compress_voip_is_active(adev) || + audio_extn_hfp_is_active(adev))) { if ((adev->voice.tty_mode != TTY_MODE_OFF) && !voice_extn_compress_voip_is_active(adev)) { if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || diff --git a/hal/voice.c b/hal/voice.c index ff6da5ac..91eb3ff3 100644 --- a/hal/voice.c +++ b/hal/voice.c @@ -363,6 +363,22 @@ uint32_t voice_get_active_session_id(struct audio_device *adev) return session_id; } +bool voice_check_voicecall_usecases_active(struct audio_device *adev) +{ + struct listnode *node; + struct audio_usecase *usecase = NULL; + + list_for_each(node, &adev->usecase_list) { + usecase = node_to_item(node, struct audio_usecase, list); + if (usecase->type == VOICE_CALL) { + ALOGV("%s: voice usecase:%s is active", __func__, + use_case_table[usecase->id]); + return true; + } + } + return false; +} + int voice_check_and_set_incall_rec_usecase(struct audio_device *adev, struct stream_in *in) { diff --git a/hal/voice.h b/hal/voice.h index bc9aa21c..38d5721e 100644 --- a/hal/voice.h +++ b/hal/voice.h @@ -104,4 +104,5 @@ void voice_check_and_update_aanc_path(struct audio_device *adev, bool voice_is_call_state_active(struct audio_device *adev); void voice_set_device_mute_flag (struct audio_device *adev, bool state); snd_device_t voice_get_incall_rec_backend_device(struct stream_in *in); +bool voice_check_voicecall_usecases_active(struct audio_device *adev); #endif //VOICE_H |
