APM: support product strategy routing
Audio policy engine supports receiving a preferred device to use
for a given strategy (Engine superclass). Use of the preferred
device intervenes at the level of the each engine implementation,
here in the default engine in getDevicesForProductStrategy() method
so it is saved in the routing cache, and respects existing routing
priorities.
Refactor the loops for call and output rerouting into a new
updateCallAndOutputRouting() method.
Bug: 144440677
Test: atest AudioServiceHostTest#testPreferredDeviceRouting
Change-Id: Ic4c690e1b0d8020c4335979e40e14e6df5887879
diff --git a/services/audiopolicy/AudioPolicyInterface.h b/services/audiopolicy/AudioPolicyInterface.h
index 92d8c83..00f14e1 100644
--- a/services/audiopolicy/AudioPolicyInterface.h
+++ b/services/audiopolicy/AudioPolicyInterface.h
@@ -282,6 +282,14 @@
volume_group_t &volumeGroup) = 0;
virtual bool isCallScreenModeSupported() = 0;
+
+ virtual status_t setPreferredDeviceForStrategy(product_strategy_t strategy,
+ const AudioDeviceTypeAddr &device) = 0;
+
+ virtual status_t removePreferredDeviceForStrategy(product_strategy_t strategy) = 0;
+
+ virtual status_t getPreferredDeviceForStrategy(product_strategy_t strategy,
+ AudioDeviceTypeAddr &device) = 0;
};