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
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 0adaac9..bded309 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -4064,7 +4064,14 @@
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();
}
}