AudioService AudioDeviceBroker: fix speakerphone control
Add a list of clients for speakerphone mode requests similar
to Bluetooth SCO clients. This allows to keep track of requests
by different apps in case of overlap or concurrency and to apply
the most relevant mode according to current audio mode owner.
Also:
- Restore requested speakerphone mode when SCO audio is disconnected
instead of returning to earpiece.
- Remove special check on permission while in call in
AudioService.setSpeakerphoneOn because the priority is now
managed by AudioDeviceBroker based on audio mode owner (the owner
for MODE_IN_CALL must have the modify phone state permission).
- Fix condition in AudioService.setMode() preventing from changing
mode while in call. Now allows releasing mode to NORMAL or
reapplying the same mode and just change mode owner.
- Add more information in dumpsys for AudioDeviceBroker and BtHelper.
Bug: 154464603
Test: test transitions between cell call and VoIP calls
Test: Test regressions with calls in speakerphone mode and Bluetooth
Test: AudioManagerTest#testRouting, NoAudioPermissionTest#testRouting
Change-Id: I0d288acf2373c96d52eb91a6ab7142cc3535c719
5 files changed