AudioService: cache routing queries by stream types
Add support for caching the result of getDevicesForStream
in the AudioSystem adapter class, as well as stats
(number of calls + time spent in methods) and debug mode
(to compare value in cache with real query).
Also add hooks for invalidation of the cache, either
through a callback from APM, or whenever an AudioSystem
method is called that will affect routing and should
cause a cache invalidation.
Bug: 162448412
Test: atest AudioServiceHostTest#testPreferredDeviceRouting
Test: atest AudioServiceHostTest#testDevicesForAttributes
Change-Id: Icceef4edb89653c7d0eddbef523c9cde2c33185b
4 files changed