From 4bd7cb0e07a1fbc4e658810631132cebd5b1fdd6 Mon Sep 17 00:00:00 2001 From: Jake Hamby Date: Thu, 6 Jan 2011 21:01:30 -0800 Subject: [PATCH] Don't auto connect reverse tethering after pairing. Added boolean param to connect() method in CachedBluetoothDevice to specify whether to connect PAN profile. This is set to true when the user clicks on a device in the paired devices list, but false when auto connecting profiles after pairing and other circumstances. Bug: 3330207 Change-Id: I6d8d50abb65a8cb24f87ad93c01693923991b6ef --- .../settings/bluetooth/CachedBluetoothDevice.java | 10 +++++----- src/com/android/settings/bluetooth/DockService.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java index c31f49d8c0c..46391d38712 100644 --- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java +++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java @@ -140,7 +140,7 @@ class CachedBluetoothDevice implements Comparable { if (isConnected()) { askDisconnect(); } else if (bondState == BluetoothDevice.BOND_BONDED) { - connect(); + connect(true); } else if (bondState == BluetoothDevice.BOND_NONE) { pair(); } @@ -264,18 +264,18 @@ class CachedBluetoothDevice implements Comparable { super.finalize(); } - public void connect() { + public void connect(boolean connectAllProfiles) { if (!ensurePaired()) return; mConnectAttempted = SystemClock.elapsedRealtime(); - connectWithoutResettingTimer(true); + connectWithoutResettingTimer(connectAllProfiles); } /*package*/ void onBondingDockConnect() { // Attempt to connect if UUIDs are available. Otherwise, // we will connect when the ACTION_UUID intent arrives. - connect(); + connect(false); } private void connectWithoutResettingTimer(boolean connectAllProfiles) { @@ -646,7 +646,7 @@ class CachedBluetoothDevice implements Comparable { if (mDevice.isBluetoothDock()) { onBondingDockConnect(); } else if (mConnectAfterPairing) { - connect(); + connect(false); } mConnectAfterPairing = false; } diff --git a/src/com/android/settings/bluetooth/DockService.java b/src/com/android/settings/bluetooth/DockService.java index d165f9bc21d..8104652389a 100644 --- a/src/com/android/settings/bluetooth/DockService.java +++ b/src/com/android/settings/bluetooth/DockService.java @@ -663,7 +663,7 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli } if (profileManager.getPreferred(device) == auto) { - cachedDevice.connect(); + cachedDevice.connect(false); break; } } @@ -735,7 +735,7 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli if (callConnect) { if (DEBUG) Log.d(TAG, "applyBtSettings - Connecting"); - cachedDevice.connect(); + cachedDevice.connect(false); } }