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

Commit 8637747f authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Fix routing for wired headset

Bug: 8239898
Change-Id: Id001206b2e5aa441340b38d62fbcee7449cf5cba
parent 8455fa7d
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -370,6 +370,9 @@ static snd_device_t get_output_snd_device(struct audio_device *adev)
        } else if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADSET |
                               AUDIO_DEVICE_OUT_SPEAKER)) {
            snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES;
        } else if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADSET |
                               AUDIO_DEVICE_OUT_WIRED_HEADPHONE)) {
            snd_device = SND_DEVICE_OUT_HEADPHONES;
        } else if (devices == (AUDIO_DEVICE_OUT_AUX_DIGITAL |
                               AUDIO_DEVICE_OUT_SPEAKER)) {
            snd_device = SND_DEVICE_OUT_SPEAKER_AND_HDMI;
@@ -381,6 +384,18 @@ static snd_device_t get_output_snd_device(struct audio_device *adev)
            goto exit;
        }
    }

    if (popcount(devices) == 3) {
        if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
                        AUDIO_DEVICE_OUT_WIRED_HEADSET |
                        AUDIO_DEVICE_OUT_SPEAKER)) {
            snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES;
        } else {
            ALOGE("%s: Invalid combo device(0x%x)", __func__, devices);
        }
        goto exit;
    }

    if (popcount(devices) != 1) {
        ALOGE("%s: Invalid output devices(0x%x)", __func__, devices);
        goto exit;