AudioService: fix A2DP (dis)connection during media playback
Fix issue with A2DP connection/disconnection during media
playback by modifying:
- how messages related to A2DP connection/disconnection are
removed from the AudioDeviceBroker message handler: have
.equals() be used when checking which object to remove,
and correct which class is used for the messages in the
queue:
* MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_*CONNECTED is
using BtHelper.BluetoothA2dpDeviceInfo
* MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT_CONNECTION
is using BtDeviceConnectionInfo
- locking: use the AudioDeviceBroker main lock, mDeviceStateLock
to synchronize posting events on the handler, and removing
some of those messages to avoid race conditions the thread
in which events are posted (e.g. BT's event thread) and the
AudioDeviceBroker handler thread.
Cleanup: annotation around audio formats from native defined
in AudioSystem, moved conversions to AudioSystem.
Bug: 142293357
Test: atest AudioDeviceBrokerTest
Change-Id: I2e8dc813354829fb1b2c7ca95ad395a14f8b70cf
4 files changed