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

Commit 2c37fd3a authored by Eric Laurent's avatar Eric Laurent
Browse files

audio: fix device address conversion to HIDL

Fix deviceAddressFromHal() method to allow empty device
address string which is a legit value in some contexts.

Bug: 34767019
Test: run Loopback app over USB dongle.

Change-Id: I1f7407d23b4cdf6011df75e854ff60595645b74d
parent 2b118b8f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -50,6 +50,10 @@ namespace {
status_t deviceAddressFromHal(
        audio_devices_t device, const char* halAddress, DeviceAddress* address) {
    address->device = AudioDevice(device);

    if (address == nullptr || strnlen(halAddress, AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) {
        return OK;
    }
    const bool isInput = (device & AUDIO_DEVICE_BIT_IN) != 0;
    if (isInput) device &= ~AUDIO_DEVICE_BIT_IN;
    if ((!isInput && (device & AUDIO_DEVICE_OUT_ALL_A2DP) != 0)