audioservice: improve SCO audio control logic
In AudioDeviceBroker, make sure all methods controlling the SCO audio
state are called from the handler thread to propely serialize them.
This is important in a scenario were multiple clients are
interacting and try to control SCO audio activity independently.
For instance when a VoIP call over SCO is interrupted by an incoming call
and the call is rejected.
Also make sure we properly restart the SCO audio link if requested
(instead of just reapplying the route according to actual SCO audio state)
when a change in audio mode owner happens or SCO audio is disconnected.
Bug: 206739623
Test: repro steps in bug
Change-Id: I5ddeaffac4fe26316f084505d692d2fc80cff467
Merged-In: I5ddeaffac4fe26316f084505d692d2fc80cff467
2 files changed