summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumar@google.com>2010-10-12 16:14:10 -0700
committerJaikumar Ganesh <jaikumar@google.com>2010-10-12 16:19:40 -0700
commitd3a460cce7b6a4f1e81f3c15b5f7949d28fdc929 (patch)
tree70e199477af339f1af828ead0031cb952547456e
parent737e91efb15fe5908781bc1cf446d28abc7726e8 (diff)
downloadpackages_apps_settings-d3a460cce7b6a4f1e81f3c15b5f7949d28fdc929.zip
packages_apps_settings-d3a460cce7b6a4f1e81f3c15b5f7949d28fdc929.tar.gz
packages_apps_settings-d3a460cce7b6a4f1e81f3c15b5f7949d28fdc929.tar.bz2
Call disconnect / connect without checking the current status
Its the job of the framework to check that, it already does that. Framework will queue the commands. Earlier settings app used to queue them. Bug: 3076404 Change-Id: I664e1c4e2c0ef9c697066251ccca382ad12dfa2f
-rw-r--r--src/com/android/settings/bluetooth/CachedBluetoothDevice.java29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index 88e343e..f8d25ac 100644
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -163,19 +163,12 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
LocalBluetoothProfileManager profileManager =
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
int status = profileManager.getConnectionStatus(cachedDevice.mDevice);
- if (SettingsBtStatus.isConnectionStatusConnected(status)) {
- if (profileManager.disconnect(cachedDevice.mDevice)) {
- if (D) {
- Log.d(TAG, "Command sent successfully:DISCONNECT " + describe(profile));
- }
- return true;
- }
- if (V) {
- Log.v(TAG, "Framework rejected command immediately:DISCONNECT " +
- describe(profile));
+ if (profileManager.disconnect(cachedDevice.mDevice)) {
+ if (D) {
+ Log.d(TAG, "Command sent successfully:DISCONNECT " + describe(profile));
}
+ return true;
}
-
return false;
}
@@ -302,17 +295,13 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
LocalBluetoothProfileManager profileManager =
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
int status = profileManager.getConnectionStatus(cachedDevice.mDevice);
- if (!SettingsBtStatus.isConnectionStatusConnected(status)) {
- if (profileManager.connect(cachedDevice.mDevice)) {
- if (D) {
- Log.d(TAG, "Command sent successfully:CONNECT " + describe(profile));
- }
- return true;
+ if (profileManager.connect(cachedDevice.mDevice)) {
+ if (D) {
+ Log.d(TAG, "Command sent successfully:CONNECT " + describe(profile));
}
- Log.i(TAG, "Failed to connect " + profile.toString() + " to " + cachedDevice.mName);
- } else {
- Log.i(TAG, "Already connected");
+ return true;
}
+ Log.i(TAG, "Failed to connect " + profile.toString() + " to " + cachedDevice.mName);
return false;
}