AudioService: fix capture policy restoration
Fix ConcurrentModificationException thrown during capture policy
restoration. The code was retrieving the list of mappings from
uid to capture policies (ALLOW_CAPTURE_*) to send them to
AudioSystem. In case of failure, the capture policy was reset
and thus modified the mapping list.
Because the iteration happened on the same list it was trying to
modify, an exception was thrown.
The fix consists in iterating over a copy of the list of mappings
instead of the actual list, a private field in the PlaybackMonitor
class.
Bug: 192496758
Test: atest AudioPlaybackCaptureTest, AudioPlaybackConfigurationTest
Change-Id: I80afc28e5ddd8d389803306a7fa6da8f6fec3987
1 file changed