OSDN Git Service

AdapterProperties: Track connection state change from more profiles
authorJack He <siyuanh@google.com>
Fri, 21 Apr 2017 01:53:11 +0000 (18:53 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Fri, 21 Apr 2017 23:29:59 +0000 (23:29 +0000)
commit122aff50aec1a1eb6cef8c94c84e33dae7194e31
treea06ae789bc38e3d346f8862a45bdf46ef4de3e66
parent33da1927a72bf3b170b4f7c6f9cc386824427e72
AdapterProperties: Track connection state change from more profiles

* AdapterProperties should handle ACTION_CONNECTION_STATE_CHANGED intent
  from more profiles
* AdapterProperties sends BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED
  with STATE_CONNECTING and STATE_CONNECTED when first profile send out
  the same intent, and with STATE_DISCONNECTING and STATE_DISCONNECTED
  when last profile send out the same intent.
* At the same moment, AdapterProperties also update the return value for
  BluetoothAdapter.getConnectionState()
* Currently, we are only tracking HEADSET (HFP), HEADSET_CLIENT (HFP), A2DP,
  A2DP_SINK profiles, other profiles such as PAN, PBAP, HID profiles are
  not tracked properly and their state change could be missed by
  both intent users and BluetoothAdapter.getConnectionState()
* After this CL, the following profiles will be tracked:
  AVRCP_CONTROLLER, A2DP, A2DP_SINK, HEADSET, HEADSET_CLIENT,
  INPUT_HOST, INPUT_DEVICE, MAP, MAP_CLIENT, PAN, PBAP_CLIENT, SAP

Bug: 37546066
Test: make, test connect and disconnect each profiles
Change-Id: I2ef0e55f58e6f7891823137e2e4534e97a126c25
(cherry picked from commit cbdcb7e4fc76661793877f142f628864797cb970)
src/com/android/bluetooth/btservice/AdapterProperties.java