Audio policy: notify system_server of routing change
Callback into AudioPolicyClientInterface to notify of routing
update whenever output is re-evaluated.
Add native test to verify callback is invoked on device
(dis)connection and setForceUse.
Bug: 162448412
Test: atest AudioServiceHostTest#testPreferredDeviceRouting
Test: atest AudioServiceHostTest#testDevicesForAttributes
Test: atest audiopolicy_tests:AudioPolicyManagerTestDeviceConnection#RoutingUpdate
Change-Id: Ia1a985b996bf8f2f63e72c4110f62f65f9f42f21
diff --git a/services/audiopolicy/tests/AudioPolicyManagerTestClient.h b/services/audiopolicy/tests/AudioPolicyManagerTestClient.h
index 433a6ff..e2d7d17 100644
--- a/services/audiopolicy/tests/AudioPolicyManagerTestClient.h
+++ b/services/audiopolicy/tests/AudioPolicyManagerTestClient.h
@@ -123,6 +123,17 @@
virtual void addSupportedFormat(audio_format_t /* format */) {}
+ void onRoutingUpdated() override {
+ mRoutingUpdatedUpdateCount++;
+ }
+
+ void resetRoutingUpdatedCounter() {
+ mRoutingUpdatedUpdateCount = 0;
+ }
+
+ size_t getRoutingUpdatedCounter() const {
+ return mRoutingUpdatedUpdateCount; }
+
private:
audio_module_handle_t mNextModuleHandle = AUDIO_MODULE_HANDLE_NONE + 1;
audio_io_handle_t mNextIoHandle = AUDIO_IO_HANDLE_NONE + 1;
@@ -130,6 +141,7 @@
std::map<audio_patch_handle_t, struct audio_patch> mActivePatches;
std::set<std::string> mAllowedModuleNames;
size_t mAudioPortListUpdateCount = 0;
+ size_t mRoutingUpdatedUpdateCount = 0;
};
} // namespace android