Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3ca4c80 authored by kunleiz's avatar kunleiz
Browse files

hal: fix output device selection when start voice call

When primary output device is set to A2DP, voice usecase
will select BT_A2DP for output device. This is not valid
device for voice call.

Fix it by add A2DP check to avoid voice call start at A2DP.

CRs-Fixed: 2227493
Change-Id: Iad5bda633f7ff2c456ae1a7b015845b37c5e1c39
parent 146c371e
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -4016,8 +4016,6 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o
                snd_device = SND_DEVICE_OUT_BT_SCO_WB;
            else
                snd_device = SND_DEVICE_OUT_BT_SCO;
        } else if (devices & AUDIO_DEVICE_OUT_ALL_A2DP) {
                snd_device = SND_DEVICE_OUT_BT_A2DP;
        } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) {
                if (my_data->is_vbat_speaker) {
                    if (my_data->mono_speaker == SPKR_1)
+0 −2
Original line number Diff line number Diff line
@@ -3858,8 +3858,6 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o
                    } else
                            snd_device = SND_DEVICE_OUT_VOICE_SPEAKER;
                }
        } else if (devices & AUDIO_DEVICE_OUT_ALL_A2DP) {
            snd_device = SND_DEVICE_OUT_BT_A2DP;
        } else if (devices & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET ||
                   devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) {
            snd_device = SND_DEVICE_OUT_USB_HEADSET;
+6 −5
Original line number Diff line number Diff line
@@ -226,16 +226,17 @@ int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
        goto error_start_voice;
    }

    uc_info->in_snd_device = SND_DEVICE_NONE;
    uc_info->out_snd_device = SND_DEVICE_NONE;

    if (audio_is_bluetooth_sco_device(uc_info->devices) && !adev->bt_sco_on) {
        ALOGE("start_call: couldn't find BT SCO, SCO is not ready");
    if ((audio_is_bluetooth_sco_device(uc_info->devices) && !adev->bt_sco_on) ||
        audio_is_a2dp_out_device(uc_info->devices)) {
        ALOGE("start_call: BT SCO is chosen but SCO is not ready, or A2DP is selected");
        adev->voice.in_call = false;
        ret = -EIO;
        goto error_start_voice;
    }

    uc_info->in_snd_device = SND_DEVICE_NONE;
    uc_info->out_snd_device = SND_DEVICE_NONE;

    list_add_tail(&adev->usecase_list, &uc_info->list);

    select_devices(adev, usecase_id);