Merge "Disconnect dock only if its connected." into gingerbread
diff --git a/src/com/android/settings/bluetooth/DockService.java b/src/com/android/settings/bluetooth/DockService.java
index db24554..280ac92 100644
--- a/src/com/android/settings/bluetooth/DockService.java
+++ b/src/com/android/settings/bluetooth/DockService.java
@@ -718,9 +718,12 @@
// Checked but not connected
callConnect = true;
} else if (!mCheckedItems[i]) {
- // Unchecked but connected
- if (DEBUG) Log.d(TAG, "applyBtSettings - Disconnecting");
- cachedDevice.disconnect(mProfiles[i]);
+ // Unchecked, may or may not be connected.
+ int status = profileManager.getConnectionStatus(cachedDevice.getDevice());
+ if (SettingsBtStatus.isConnectionStatusConnected(status)) {
+ if (DEBUG) Log.d(TAG, "applyBtSettings - Disconnecting");
+ cachedDevice.disconnect(mProfiles[i]);
+ }
}
profileManager.setPreferred(device, mCheckedItems[i]);
if (DEBUG) {