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
This commit is contained in:
Jaikumar Ganesh
2010-10-14 15:01:38 -07:00
parent 825db2da05
commit 9d03e98d22

View File

@@ -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) {