From 9d03e98d22c51e81a01b2bdc91b825bd3b438481 Mon Sep 17 00:00:00 2001 From: Jaikumar Ganesh Date: Thu, 14 Oct 2010 15:01:38 -0700 Subject: [PATCH] Disconnect dock only if its connected. Scenario: BT is off, device is paired with the desk dock. Media is switched off. So when the user docks, it was trying to disconnect even when BT was off and hence DBUS was crashing. Bug: 3097224 Change-Id: I13e1dd4459c47d5ba9a403f2ae1cc8a131f02a08 --- src/com/android/settings/bluetooth/DockService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/bluetooth/DockService.java b/src/com/android/settings/bluetooth/DockService.java index db24554395f..280ac92867b 100644 --- a/src/com/android/settings/bluetooth/DockService.java +++ b/src/com/android/settings/bluetooth/DockService.java @@ -718,9 +718,12 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli // 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) {