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
This commit is contained in:
Ravi Nagarajan
2012-05-22 18:08:48 +05:30
committed by Matthew Xie
parent afedeacd57
commit d1889ed4bd

View File

@@ -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);