From 37bf3353d15fb7927b52fa8f8883a7c6c865fae4 Mon Sep 17 00:00:00 2001 From: Jaikumar Ganesh Date: Tue, 8 Mar 2011 18:03:00 -0800 Subject: [PATCH] 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 --- src/com/android/settings/bluetooth/HeadsetProfile.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/com/android/settings/bluetooth/HeadsetProfile.java b/src/com/android/settings/bluetooth/HeadsetProfile.java index dac47b767ba..e9c52ef0bb4 100644 --- a/src/com/android/settings/bluetooth/HeadsetProfile.java +++ b/src/com/android/settings/bluetooth/HeadsetProfile.java @@ -133,6 +133,8 @@ final class HeadsetProfile implements LocalBluetoothProfile { } public int getConnectionStatus(BluetoothDevice device) { + if (mService == null) return BluetoothProfile.STATE_DISCONNECTED; + List deviceList = mService.getConnectedDevices(); return !deviceList.isEmpty() && deviceList.get(0).equals(device)