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

Commit dff872d2 authored by kunleiz's avatar kunleiz
Browse files

hal: use correct usb card state when setting in/out device

usb card state is wrong to check when usb headset is connected.

Fix it by using correct usb card state when setting in/out
device.

CRs-Fixed: 2299874
Change-Id: Ifed23b8dda78f47495f4ddd2e270ba79fc35e280
parent 7b947dc3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -5733,7 +5733,7 @@ int adev_open_output_stream(struct audio_hw_device *dev,
                      (devices != AUDIO_DEVICE_OUT_USB_ACCESSORY);
    bool direct_dev = is_hdmi || is_usb_dev;

    if (is_usb_dev && (audio_extn_usb_connected(NULL))) {
    if (is_usb_dev && (!audio_extn_usb_connected(NULL))) {
        is_usb_dev = false;
        devices = AUDIO_DEVICE_OUT_SPEAKER;
        ALOGW("%s: ignore set device to non existing USB card, use output device(%#x)",
@@ -6862,7 +6862,7 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
                                                            flags,
                                                            source);

    if (is_usb_dev && (audio_extn_usb_connected(NULL))) {
    if (is_usb_dev && (!audio_extn_usb_connected(NULL))) {
        is_usb_dev = false;
        devices = AUDIO_DEVICE_IN_BUILTIN_MIC;
        ALOGW("%s: ignore set device to non existing USB card, use input device(%#x)",