OSDN Git Service

BT-HFP: Update Bluetooth headset state handler to Multi-HFP
authorJack He <siyuanh@google.com>
Wed, 17 Jan 2018 23:45:12 +0000 (15:45 -0800)
committerPavlin Radoslavov <pavlin@google.com>
Wed, 24 Jan 2018 16:27:15 +0000 (16:27 +0000)
commit8dd33941a455bab025beaa549b78c094e81226e2
treecddf09bda0a966d5ec73ecf8ed6673c63c148047
parentc584d2772d6579904868dab3562720bfec51112c
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
services/core/java/com/android/server/audio/AudioService.java