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

Commit 7e0b8759 authored by Preetam Singh Ranawat's avatar Preetam Singh Ranawat
Browse files

Revert "hal: Fix no audio during voice call with concurrent combo use case"

This reverts commit 7c8bc14e.

Change-Id: If015e782eefaa63c590c3b89b3760bbc6e5b1b51
parent bb4f7aca
Loading
Loading
Loading
Loading
+22 −38
Original line number Diff line number Diff line
@@ -3416,17 +3416,11 @@ int platform_split_snd_device(void *platform,
{
    int ret = -EINVAL;
    struct platform_data *my_data = (struct platform_data *)platform;
    bool is_voice_call_active = false;
    if (NULL == num_devices || NULL == new_snd_devices) {
        ALOGE("%s: NULL pointer ..", __func__);
        return -EINVAL;
    }

    if ((my_data->adev->mode == AUDIO_MODE_IN_CALL) ||
            voice_is_in_call(my_data->adev) ||
            voice_extn_compress_voip_is_active(my_data->adev)) {
        is_voice_call_active = true;
    }
    /*
     * If wired headset/headphones/line devices share the same backend
     * with speaker/earpiece this routine returns -EINVAL.
@@ -3435,31 +3429,37 @@ int platform_split_snd_device(void *platform,
        !platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, SND_DEVICE_OUT_HEADPHONES)) {
        *num_devices = 2;

        new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
        if (is_voice_call_active)
            new_snd_devices[1] = SND_DEVICE_OUT_VOICE_HEADPHONES;
         if (my_data->is_vbat_speaker)
             new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER_VBAT;
         else if (my_data->is_wsa_speaker)
             new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER_WSA;
         else
            new_snd_devices[1] = SND_DEVICE_OUT_HEADPHONES;
        ret = 0;
    } else if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET &&
               !platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, SND_DEVICE_OUT_ANC_HEADSET)) {
        *num_devices = 2;
             new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
        if (is_voice_call_active)
            new_snd_devices[1] = SND_DEVICE_OUT_VOICE_ANC_HEADSET;
        else
            new_snd_devices[1] = SND_DEVICE_OUT_ANC_HEADSET;

        new_snd_devices[1] = SND_DEVICE_OUT_HEADPHONES;
        ret = 0;
    } else if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_HDMI &&
               !platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, SND_DEVICE_OUT_HDMI)) {
        *num_devices = 2;

        if (my_data->is_vbat_speaker)
            new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER_VBAT;
        else if (my_data->is_wsa_speaker)
            new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER_WSA;
        else
            new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;

        new_snd_devices[1] = SND_DEVICE_OUT_HDMI;
        ret = 0;
    } else if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_DISPLAY_PORT &&
               !platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, SND_DEVICE_OUT_DISPLAY_PORT)) {
        *num_devices = 2;

        if (my_data->is_vbat_speaker)
            new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER_VBAT;
        else if (my_data->is_wsa_speaker)
            new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER_WSA;
        else
            new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;

        new_snd_devices[1] = SND_DEVICE_OUT_DISPLAY_PORT;
@@ -3476,22 +3476,6 @@ int platform_split_snd_device(void *platform,
        new_snd_devices[1] = SND_DEVICE_OUT_BT_A2DP;
        ret = 0;
    }
    if (*num_devices == 2 && new_snd_devices[0] == SND_DEVICE_OUT_SPEAKER) {
        if (my_data->is_vbat_speaker) {
            if (is_voice_call_active)
                new_snd_devices[0] = SND_DEVICE_OUT_VOICE_SPEAKER_VBAT;
            else
                new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER_VBAT;
        } else if (my_data->is_wsa_speaker) {
            if (is_voice_call_active)
                new_snd_devices[0] = SND_DEVICE_OUT_VOICE_SPEAKER_WSA;
            else
                new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER_WSA;
        } else {
            if (is_voice_call_active)
                new_snd_devices[0] = SND_DEVICE_OUT_VOICE_SPEAKER;
        }
    }

    if (*num_devices == 2)
        ALOGD("%s: snd_device(%d) new_snd_devices(0) (%s) new_snd_devices(1) (%s)", __func__,
+2 −14
Original line number Diff line number Diff line
@@ -3090,18 +3090,12 @@ int platform_split_snd_device(void *platform,
{
    int ret = -EINVAL;
    struct platform_data *my_data = (struct platform_data *)platform;
    bool is_voice_call_active = false;

    if ( NULL == num_devices || NULL == new_snd_devices || NULL == my_data) {
        ALOGE("%s: NULL pointer ..", __func__);
        return -EINVAL;
    }

    if ((my_data->adev->mode == AUDIO_MODE_IN_CALL) ||
            voice_is_in_call(my_data->adev) ||
            voice_extn_compress_voip_is_active(my_data->adev)) {
        is_voice_call_active = true;
    }
    /*
     * If wired headset/headphones/line devices share the same backend
     * with speaker/earpiece this routine returns -EINVAL.
@@ -3109,13 +3103,8 @@ int platform_split_snd_device(void *platform,
    if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES &&
        !platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, SND_DEVICE_OUT_HEADPHONES)) {
        *num_devices = 2;
        if (is_voice_call_active) {
            new_snd_devices[0] = SND_DEVICE_OUT_VOICE_SPEAKER;
            new_snd_devices[1] = SND_DEVICE_OUT_VOICE_HEADPHONES;
        } else {
        new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
        new_snd_devices[1] = SND_DEVICE_OUT_HEADPHONES;
        }
        ret = 0;
    } else if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_HDMI &&
               !platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, SND_DEVICE_OUT_HDMI)) {
@@ -3150,7 +3139,6 @@ int platform_split_snd_device(void *platform,
        ALOGD("%s: snd_device(%d) new_snd_devices (%s)", __func__,
              snd_device, platform_get_snd_device_name(snd_device));


    return ret;
}