Return profile state disconnected when not yet bound to service.

Bug: 4007080

There is a another bug open to handle service object being null
and a connect / disconnect call being made.

Change-Id: I30f6923323532b5756338b350ec4ce0e1a31d1ff
This commit is contained in:
Jaikumar Ganesh
2011-03-08 18:03:00 -08:00
parent e0db177334
commit 37bf3353d1

View File

@@ -133,6 +133,8 @@ final class HeadsetProfile implements LocalBluetoothProfile {
} }
public int getConnectionStatus(BluetoothDevice device) { public int getConnectionStatus(BluetoothDevice device) {
if (mService == null) return BluetoothProfile.STATE_DISCONNECTED;
List<BluetoothDevice> deviceList = mService.getConnectedDevices(); List<BluetoothDevice> deviceList = mService.getConnectedDevices();
return !deviceList.isEmpty() && deviceList.get(0).equals(device) return !deviceList.isEmpty() && deviceList.get(0).equals(device)