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
This commit is contained in:
@@ -163,19 +163,12 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
|
|||||||
LocalBluetoothProfileManager profileManager =
|
LocalBluetoothProfileManager profileManager =
|
||||||
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
|
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
|
||||||
int status = profileManager.getConnectionStatus(cachedDevice.mDevice);
|
int status = profileManager.getConnectionStatus(cachedDevice.mDevice);
|
||||||
if (SettingsBtStatus.isConnectionStatusConnected(status)) {
|
|
||||||
if (profileManager.disconnect(cachedDevice.mDevice)) {
|
if (profileManager.disconnect(cachedDevice.mDevice)) {
|
||||||
if (D) {
|
if (D) {
|
||||||
Log.d(TAG, "Command sent successfully:DISCONNECT " + describe(profile));
|
Log.d(TAG, "Command sent successfully:DISCONNECT " + describe(profile));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (V) {
|
|
||||||
Log.v(TAG, "Framework rejected command immediately:DISCONNECT " +
|
|
||||||
describe(profile));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +295,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
|
|||||||
LocalBluetoothProfileManager profileManager =
|
LocalBluetoothProfileManager profileManager =
|
||||||
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
|
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
|
||||||
int status = profileManager.getConnectionStatus(cachedDevice.mDevice);
|
int status = profileManager.getConnectionStatus(cachedDevice.mDevice);
|
||||||
if (!SettingsBtStatus.isConnectionStatusConnected(status)) {
|
|
||||||
if (profileManager.connect(cachedDevice.mDevice)) {
|
if (profileManager.connect(cachedDevice.mDevice)) {
|
||||||
if (D) {
|
if (D) {
|
||||||
Log.d(TAG, "Command sent successfully:CONNECT " + describe(profile));
|
Log.d(TAG, "Command sent successfully:CONNECT " + describe(profile));
|
||||||
@@ -310,9 +302,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Log.i(TAG, "Failed to connect " + profile.toString() + " to " + cachedDevice.mName);
|
Log.i(TAG, "Failed to connect " + profile.toString() + " to " + cachedDevice.mName);
|
||||||
} else {
|
|
||||||
Log.i(TAG, "Already connected");
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user