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

Commit dda24503 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "audio policy: fix input preferred device logic" into main

parents 84d381ed d8add2be
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -64,6 +64,21 @@ sp<DeviceDescriptor> findPreferredDevice(
            if (activeClients.size() == activeClientsWithRoute.size()) {
                return devices.getDeviceFromId(activeClientsWithRoute[0]->preferredDeviceId());
            }
            if (activeClientsWithRoute.size() == 0) {
                return nullptr;
            }
            uid_t uniqueUid = activeClients[0]->uid();
            for (const auto &client : activeClients) {
                if (uniqueUid != client->uid()) {
                   return nullptr;
                }
            }
            for (const auto &client : activeClientsWithRoute) {
                if (uniqueUid != client->uid()) {
                   return nullptr;
                }
            }
            return devices.getDeviceFromId(activeClientsWithRoute[0]->preferredDeviceId());
        }
    }
    return nullptr;
+2 −1
Original line number Diff line number Diff line
@@ -7839,7 +7839,8 @@ sp<DeviceDescriptor> AudioPolicyManager::getNewInputDevice(
    }

    // Honor explicit routing requests only if no client using default routing is active on this
    // input: a specific app can not force routing for other apps by setting a preferred device.
    // input or if all active clients are from the same app: a specific app can not force routing
    // for other apps by setting a preferred device.
    bool active;
    device = findPreferredDevice(inputDesc, AUDIO_SOURCE_DEFAULT, active, mAvailableInputDevices);
    if (device != nullptr) {