summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumar@google.com>2010-09-16 19:08:32 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-09-16 19:08:32 -0700
commit213d579f98a83145989f11cfdbd47631b64de000 (patch)
treeee026e8cfd98380634d878798965b8ccfe317c22 /src
parent5c2a46848133c0ad6b2197aa1d6f5ae2ba9c8119 (diff)
parent84905edb6315ac0af53141cf2f91591443d7422a (diff)
downloadpackages_apps_Settings-213d579f98a83145989f11cfdbd47631b64de000.zip
packages_apps_Settings-213d579f98a83145989f11cfdbd47631b64de000.tar.gz
packages_apps_Settings-213d579f98a83145989f11cfdbd47631b64de000.tar.bz2
Merge "Don't disconnect the same device before connecting." into gingerbread
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/bluetooth/CachedBluetoothDevice.java21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index 48fd85d..9b16005 100644
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -86,10 +86,10 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
// See mConnectAttempted
private static final long MAX_UUID_DELAY_FOR_AUTO_CONNECT = 5000;
-
+
/**
* Describes the current device and profile for logging.
- *
+ *
* @param profile Profile to describe
* @return Description of the device and profile
*/
@@ -102,7 +102,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
return sb.toString();
}
-
+
private String describe(Profile profile) {
return describe(this, profile);
}
@@ -242,7 +242,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
.getProfileManager(mLocalManager, profile);
if (profileManager.isPreferred(mDevice)) {
++preferredProfiles;
- disconnectConnected(profile);
+ disconnectConnected(this, profile);
connectInt(this, profile);
}
}
@@ -265,7 +265,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager
.getProfileManager(mLocalManager, profile);
profileManager.setPreferred(mDevice, false);
- disconnectConnected(profile);
+ disconnectConnected(this, profile);
connectInt(this, profile);
}
}
@@ -275,19 +275,20 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
mConnectAttempted = SystemClock.elapsedRealtime();
// Reset the only-show-one-error-dialog tracking variable
mIsConnectingErrorPossible = true;
- disconnectConnected(profile);
+ disconnectConnected(this, profile);
connectInt(this, profile);
}
- private void disconnectConnected(Profile profile) {
+ private void disconnectConnected(CachedBluetoothDevice device, Profile profile) {
LocalBluetoothProfileManager profileManager =
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
CachedBluetoothDeviceManager cachedDeviceManager = mLocalManager.getCachedDeviceManager();
Set<BluetoothDevice> devices = profileManager.getConnectedDevices();
if (devices == null) return;
- for (BluetoothDevice device : devices) {
- CachedBluetoothDevice cachedDevice = cachedDeviceManager.findDevice(device);
- if (cachedDevice != null) {
+ for (BluetoothDevice btDevice : devices) {
+ CachedBluetoothDevice cachedDevice = cachedDeviceManager.findDevice(btDevice);
+
+ if (cachedDevice != null && !cachedDevice.equals(device)) {
disconnectInt(cachedDevice, profile);
}
}