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

Commit 961b622e authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/27931239'] into 24Q3-release.

Change-Id: Id700cde7b1db579e443ed1c1f959f4dc473a95ae
parents a922def1 b05e9773
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -47,13 +47,17 @@ sp<DeviceDescriptor> findPreferredDevice(

    if (active) {
        // On MMAP IOs, the preferred device is selected by the first client (virtual client
        // created when the mmap stream is opened). This client is never active.
        // created when the mmap stream is opened). This client is never active and we only
        // consider the Filter criteria, not the active state.
        // On non MMAP IOs, the preferred device is honored only if all active clients have
        // a preferred device in which case the first client drives the selection.
        if (desc->isMmap()) {
            // The client list is never empty on a MMAP IO
            return devices.getDeviceFromId(
                    desc->clientsList(false /*activeOnly*/)[0]->preferredDeviceId());
            auto matchingClients = desc->clientsList(
                    false /*activeOnly*/, filter, true /*preferredDevice*/);
            if (matchingClients.empty()) {
                return nullptr;
            }
            return devices.getDeviceFromId(matchingClients[0]->preferredDeviceId());
        } else {
            auto activeClientsWithRoute =
                desc->clientsList(true /*activeOnly*/, filter, true /*preferredDevice*/);