when disconnectHeadsetInternal, allow it when the BT is not disabled
The old code allowed the disconnection only when BT is enabled. This
caused a bug during BT turning off that Headset connection failed
to disconnect.
Change-Id: Iba15a1595b6987064f071ad90bbb126a6edfe6b5
diff --git a/framework/java/android/bluetooth/BluetoothHeadset.java b/framework/java/android/bluetooth/BluetoothHeadset.java
index 3284361..8f2b3d8 100644
--- a/framework/java/android/bluetooth/BluetoothHeadset.java
+++ b/framework/java/android/bluetooth/BluetoothHeadset.java
@@ -661,7 +661,7 @@
*/
public boolean disconnectHeadsetInternal(BluetoothDevice device) {
if (DBG) log("disconnectHeadsetInternal");
- if (mService != null && isEnabled()) {
+ if (mService != null && !isDisabled()) {
try {
return mService.disconnectHeadsetInternal(device);
} catch (RemoteException e) {Log.e(TAG, e.toString());}