diff options
author | Ravi Nagarajan <nravi@broadcom.com> | 2012-05-22 18:08:48 +0530 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2012-07-16 15:38:38 -0700 |
commit | d1889ed4bd9b6611347553d45aac0930dba0f136 (patch) | |
tree | dd1f19e377b87231d0ba91b4ed880f865a8cb37c /src/com/android/settings/bluetooth | |
parent | afedeacd575d51edc4f741bd2c8f75dd4928f2b6 (diff) | |
download | packages_apps_settings-d1889ed4bd9b6611347553d45aac0930dba0f136.zip packages_apps_settings-d1889ed4bd9b6611347553d45aac0930dba0f136.tar.gz packages_apps_settings-d1889ed4bd9b6611347553d45aac0930dba0f136.tar.bz2 |
Headset connection status is displayed incorrectly, as the boolean mIsProfileReady is not initalized properly. Make sure mIsProfileReady is initialized always when onServiceConnected is received
Change-Id: I968ce6900121a6140256b3181c792d421bdb7cf6
Diffstat (limited to 'src/com/android/settings/bluetooth')
-rwxr-xr-x | src/com/android/settings/bluetooth/HeadsetProfile.java | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/com/android/settings/bluetooth/HeadsetProfile.java b/src/com/android/settings/bluetooth/HeadsetProfile.java index 04c50ec..18992e0 100755 --- a/src/com/android/settings/bluetooth/HeadsetProfile.java +++ b/src/com/android/settings/bluetooth/HeadsetProfile.java @@ -65,19 +65,17 @@ final class HeadsetProfile implements LocalBluetoothProfile { // We just bound to the service, so refresh the UI of the // headset device. List<BluetoothDevice> deviceList = mService.getConnectedDevices(); - if (deviceList.isEmpty()) { - mProfileManager.setHfServiceUp(true); - return; + if (!deviceList.isEmpty()) { + BluetoothDevice firstDevice = deviceList.get(0); + CachedBluetoothDevice device = mDeviceManager.findDevice(firstDevice); + // we may add a new device here, but generally this should not happen + if (device == null) { + Log.w(TAG, "HeadsetProfile found new device: " + firstDevice); + device = mDeviceManager.addDevice(mLocalAdapter, mProfileManager, firstDevice); + } + device.onProfileStateChanged(HeadsetProfile.this, + BluetoothProfile.STATE_CONNECTED); } - BluetoothDevice firstDevice = deviceList.get(0); - CachedBluetoothDevice device = mDeviceManager.findDevice(firstDevice); - // we may add a new device here, but generally this should not happen - if (device == null) { - Log.w(TAG, "HeadsetProfile found new device: " + firstDevice); - device = mDeviceManager.addDevice(mLocalAdapter, mProfileManager, firstDevice); - } - device.onProfileStateChanged(HeadsetProfile.this, - BluetoothProfile.STATE_CONNECTED); mProfileManager.callServiceConnectedListeners(); mProfileManager.setHfServiceUp(true); |