OSDN Git Service

Show correct A2DP connection status in Bluetooth settings.
authorJake Hamby <jhamby@google.com>
Fri, 26 Apr 2013 21:38:15 +0000 (14:38 -0700)
committerJake Hamby <jhamby@google.com>
Tue, 30 Apr 2013 20:51:38 +0000 (13:51 -0700)
commit18c4317b93fce47109017efdab089dec4b01f790
treebf1506915ba59197e74fe693b5d7e1a51a24419f
parente3eb601dc232ba9a14396ec26368e0a0f14084c7
Show correct A2DP connection status in Bluetooth settings.

When BluetoothSettings is entered via QuickSettings while an A2DP
device is connected, we aren't showing the device connection
status in the UI, because the device list is created before we've
connected to the A2DP and Headset profile services, and we weren't
refreshing the device list UI after getting the callback for
onServiceConnected() and retrieving the list of connected devices.

Add a line to HeadsetServiceListener.onServiceConnected() to call
device.refresh() after we call device.onProfileStateChanged() to
refresh the device list UI. Also copy the logic into A2dpProfile's
onServiceConnected() callback so it will refresh the UI for any
connected A2DP devices.

The reason this bug doesn't show up when entering BT settings
from the main Settings screen is because the onServiceConnected()
callbacks happen before the device list is initialized, so the
UI items are created with the correct connection status. For the
same reason, the bug doesn't occur if the Settings app is already
running and we re-enter it via Bluetooth QuickSettings.

Bug: 8724247
Change-Id: I1a993636ecab18dd6e980e3b4d2485bbed256d74
src/com/android/settings/bluetooth/A2dpProfile.java
src/com/android/settings/bluetooth/HeadsetProfile.java
src/com/android/settings/bluetooth/HidProfile.java
src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java