diff options
Diffstat (limited to 'src/com/android/settings/bluetooth/DockService.java')
-rw-r--r-- | src/com/android/settings/bluetooth/DockService.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/android/settings/bluetooth/DockService.java b/src/com/android/settings/bluetooth/DockService.java index 5bf0214..1ad2987 100644 --- a/src/com/android/settings/bluetooth/DockService.java +++ b/src/com/android/settings/bluetooth/DockService.java @@ -459,19 +459,19 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli mPendingDevice = null; + boolean callConnect = false; + CachedBluetoothDevice cachedDevice = getCachedBluetoothDevice(mContext, mBtManager, + device); for (int i = 0; i < mProfiles.length; i++) { LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager .getProfileManager(mBtManager, mProfiles[i]); boolean isConnected = profileManager.isConnected(device); - CachedBluetoothDevice cachedDevice = getCachedBluetoothDevice(mContext, mBtManager, - device); if (DEBUG) Log.d(TAG, mProfiles[i].toString() + " = " + mCheckedItems[i]); if (mCheckedItems[i] && !isConnected) { // Checked but not connected - if (DEBUG) Log.d(TAG, "applyBtSettings - Connecting"); - cachedDevice.connect(mProfiles[i]); + callConnect = true; } else if (!mCheckedItems[i] && isConnected) { // Unchecked but connected if (DEBUG) Log.d(TAG, "applyBtSettings - Disconnecting"); @@ -484,6 +484,11 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli } } } + + if (callConnect) { + if (DEBUG) Log.d(TAG, "applyBtSettings - Connecting"); + cachedDevice.connect(); + } } void handleUndocked(Context context, LocalBluetoothManager localManager, |