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

Commit 0435a4dc authored by Kevin Rocard's avatar Kevin Rocard Committed by Eric Laurent
Browse files

Audiopolicy: Fix DeviceVector::getDevice logic



It was currently ignoring address even if the default format was passed.

Test: adb shell audiorecorder --target /data/file.raw
Bug: 111453086
Change-Id: I44a17fa32c4dd32c426d20bf0902bd406682743c
Signed-off-by: default avatarKevin Rocard <krocard@google.com>
parent f63dbf12
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -215,11 +215,12 @@ sp<DeviceDescriptor> DeviceVector::getDevice(audio_devices_t type, const String8
    sp<DeviceDescriptor> device;
    for (size_t i = 0; i < size(); i++) {
        if (itemAt(i)->type() == type) {
            // Assign device if address is empty or matches and
            // format is default or matches
            // If format is specified, match it and ignore address
            // Otherwise if address is specified match it
            // Otherwise always match
            if (((address == "" || itemAt(i)->address() == address) &&
                 format == AUDIO_FORMAT_DEFAULT) ||
                itemAt(i)->supportsFormat(format)) {
                (itemAt(i)->supportsFormat(format) && format != AUDIO_FORMAT_DEFAULT)) {
                device = itemAt(i);
                if (itemAt(i)->address() == address) {
                    break;