BT-HFP: Update Bluetooth headset state handler to Multi-HFP
* When multiple headset devices are connected at the same time, at most one
device can be used for SCO audio at any time. This device is called
Active Device and is indicated by either
BluetoothHeadset.getActiveDevice() or
BluetoothHeadset.ACTIVE_DEVICE_CHANGED intent. It can also be set
through BluetoothHeadset.setActiveDevice(BluetoothDevice) internal API.
* This change let AudioService to listen to ACTIVE_DEVICE_CHANGED intent
instead of CONNECTION_STATE_CHANGED intent since it is the active
device that AudioService cares about, not the list of connected
devices.
* Everytime a new active device is set, AudioService will treat the old
one (if not null) as disconnected and call disconnection methods in
audio framework and the new active device is regarded as newly
connected and connection methods will be called by AudioService.
* When disconnectHeadset() is called, active device will be set to null
Bug: 71875419
Test: compile, connect multiple HFP devices and switch active device
among them
Change-Id: I148cca079d36a2dfc6a46b8d42ba69821c9c6de3
1 file changed