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
diff --git a/src/com/android/settings/bluetooth/HeadsetProfile.java b/src/com/android/settings/bluetooth/HeadsetProfile.java
index dac47b7..e9c52ef 100644
--- a/src/com/android/settings/bluetooth/HeadsetProfile.java
+++ b/src/com/android/settings/bluetooth/HeadsetProfile.java
@@ -133,6 +133,8 @@
}
public int getConnectionStatus(BluetoothDevice device) {
+ if (mService == null) return BluetoothProfile.STATE_DISCONNECTED;
+
List<BluetoothDevice> deviceList = mService.getConnectedDevices();
return !deviceList.isEmpty() && deviceList.get(0).equals(device)