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

Commit 093a20cb authored by Eric Laurent's avatar Eric Laurent
Browse files

audio policy: fix explicit routing and accessibility

If a session has an active explicit routing request, this routing
must also be applied to accessibility prompts if accessibility
usage is currrently remapped to the strategy used by this session.

Bug: 20873151.
Change-Id: I97c6ece98cf1af9c64c2d2eb1fe382c7c0d657b4
parent 4599da7f
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -4064,7 +4064,14 @@ audio_devices_t AudioPolicyManager::getDeviceForStrategy(routing_strategy strate
    for (size_t routeIndex = 0; routeIndex < mOutputRoutes.size(); routeIndex++) {
        sp<SessionRoute> route = mOutputRoutes.valueAt(routeIndex);
        routing_strategy strat = getStrategy(route->mStreamType);
        if (strat == strategy && route->isActive()) {
        // Special case for accessibility strategy which must follow any strategy it is
        // currently remapped to
        bool strategyMatch = (strat == strategy) ||
                             ((strategy == STRATEGY_ACCESSIBILITY) &&
                              ((mEngine->getStrategyForUsage(
                                      AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY) == strat) ||
                               (strat == STRATEGY_MEDIA)));
        if (strategyMatch && route->isActive()) {
            return route->mDeviceDescriptor->type();
        }
    }