hal: use consistent in call indication
Use voice_is_in_call() instead of mode == MODE_IN_CALL as a valid indication that we are in call to choose sound devices. Change-Id: Iefa968ee463d4ade6c7d09626be667faab6eda98
This commit is contained in:
parent
8f0b1432f8
commit
be149396ca
|
@ -1786,15 +1786,18 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
|
|||
if (!out->standby)
|
||||
select_devices(adev, out->usecase);
|
||||
|
||||
if ((adev->mode == AUDIO_MODE_IN_CALL) &&
|
||||
output_drives_call(adev, out)) {
|
||||
if (output_drives_call(adev, out)) {
|
||||
if(!voice_is_in_call(adev)) {
|
||||
if (adev->mode == AUDIO_MODE_IN_CALL) {
|
||||
adev->current_call_output = out;
|
||||
if (!voice_is_in_call(adev))
|
||||
ret = voice_start_call(adev);
|
||||
else
|
||||
}
|
||||
} else {
|
||||
adev->current_call_output = out;
|
||||
voice_update_devices_for_all_voice_usecases(adev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&adev->lock);
|
||||
pthread_mutex_unlock(&out->lock);
|
||||
|
|
|
@ -1067,7 +1067,7 @@ int platform_switch_voice_call_device_pre(void *platform)
|
|||
int ret = 0;
|
||||
|
||||
if (my_data->csd != NULL &&
|
||||
my_data->adev->mode == AUDIO_MODE_IN_CALL) {
|
||||
voice_is_in_call(my_data->adev)) {
|
||||
/* This must be called before disabling mixer controls on APQ side */
|
||||
ret = my_data->csd->disable_device();
|
||||
if (ret < 0) {
|
||||
|
@ -1338,8 +1338,7 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if ((mode == AUDIO_MODE_IN_CALL) ||
|
||||
voice_extn_compress_voip_is_active(adev)) {
|
||||
if (voice_is_in_call(adev) || voice_extn_compress_voip_is_active(adev)) {
|
||||
if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
|
||||
devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
|
||||
if ((adev->voice.tty_mode != TTY_MODE_OFF) &&
|
||||
|
@ -1452,7 +1451,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
|
|||
|
||||
ALOGV("%s: enter: out_device(%#x) in_device(%#x)",
|
||||
__func__, out_device, in_device);
|
||||
if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) ||
|
||||
if ((out_device != AUDIO_DEVICE_NONE) && (voice_is_in_call(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)) {
|
||||
|
|
|
@ -493,7 +493,8 @@ int platform_switch_voice_call_device_pre(void *platform)
|
|||
struct platform_data *my_data = (struct platform_data *)platform;
|
||||
int ret = 0;
|
||||
|
||||
if (my_data->csd_client != NULL) {
|
||||
if (my_data->csd_client != NULL &&
|
||||
voice_is_in_call(my_data->adev)) {
|
||||
/* This must be called before disabling the mixer controls on APQ side */
|
||||
if (my_data->csd_disable_device == NULL) {
|
||||
ALOGE("%s: dlsym error for csd_disable_device", __func__);
|
||||
|
@ -644,7 +645,7 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if (mode == AUDIO_MODE_IN_CALL) {
|
||||
if (voice_is_in_call(adev)) {
|
||||
if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
|
||||
devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
|
||||
if (adev->voice.tty_mode == TTY_MODE_FULL)
|
||||
|
@ -736,11 +737,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
|
|||
|
||||
ALOGV("%s: enter: out_device(%#x) in_device(%#x)",
|
||||
__func__, out_device, in_device);
|
||||
if (mode == AUDIO_MODE_IN_CALL) {
|
||||
if (out_device == AUDIO_DEVICE_NONE) {
|
||||
ALOGE("%s: No output device set for voice call", __func__);
|
||||
goto exit;
|
||||
}
|
||||
if ((out_device != AUDIO_DEVICE_NONE) && voice_is_in_call(adev)) {
|
||||
if (adev->voice.tty_mode != TTY_MODE_OFF) {
|
||||
if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
|
||||
out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
|
||||
|
|
|
@ -1310,7 +1310,7 @@ int platform_switch_voice_call_device_pre(void *platform)
|
|||
int ret = 0;
|
||||
|
||||
if (my_data->csd != NULL &&
|
||||
my_data->adev->mode == AUDIO_MODE_IN_CALL) {
|
||||
voice_is_in_call(my_data->adev)) {
|
||||
/* This must be called before disabling mixer controls on APQ side */
|
||||
ret = my_data->csd->disable_device();
|
||||
if (ret < 0) {
|
||||
|
@ -1618,7 +1618,7 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if ((mode == AUDIO_MODE_IN_CALL) ||
|
||||
if (voice_is_in_call(adev) ||
|
||||
voice_extn_compress_voip_is_active(adev)) {
|
||||
if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
|
||||
devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
|
||||
|
@ -1738,7 +1738,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
|
|||
ALOGV("%s: enter: out_device(%#x) in_device(%#x)",
|
||||
__func__, out_device, in_device);
|
||||
if (my_data->external_mic) {
|
||||
if (((out_device != AUDIO_DEVICE_NONE) && (mode == AUDIO_MODE_IN_CALL)) ||
|
||||
if ((out_device != AUDIO_DEVICE_NONE && voice_is_in_call(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 ||
|
||||
|
@ -1753,7 +1753,7 @@ 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) ||
|
||||
if ((out_device != AUDIO_DEVICE_NONE) && ((voice_is_in_call(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)) {
|
||||
|
|
|
@ -373,11 +373,11 @@ int voice_start_call(struct audio_device *adev)
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
adev->voice.in_call = true;
|
||||
ret = voice_extn_start_call(adev);
|
||||
if (ret == -ENOSYS) {
|
||||
ret = voice_start_usecase(adev, USECASE_VOICE_CALL);
|
||||
}
|
||||
adev->voice.in_call = true;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue