summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Xie <mattx@google.com>2014-08-04 00:24:33 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-08-04 00:24:33 +0000
commit8f5767c3ac30f07464fd020b5245fb71e24aabff (patch)
tree87ea017d4207593c84b10dbf58419de61fdbeff8
parent2621d33175d5ec1ff8b020d019811d5e30d1cb35 (diff)
parented36a8b134c33fc8b981b8dbf6d5859d70d358a0 (diff)
downloadpackages_apps_Settings-8f5767c3ac30f07464fd020b5245fb71e24aabff.zip
packages_apps_Settings-8f5767c3ac30f07464fd020b5245fb71e24aabff.tar.gz
packages_apps_Settings-8f5767c3ac30f07464fd020b5245fb71e24aabff.tar.bz2
am ed36a8b1: am 3347624e: am 8c89e69b: Merge "Bluetooth: Multi HF support" into lmp-dev
* commit 'ed36a8b134c33fc8b981b8dbf6d5859d70d358a0': Bluetooth: Multi HF support
-rwxr-xr-xsrc/com/android/settings/bluetooth/HeadsetProfile.java33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/com/android/settings/bluetooth/HeadsetProfile.java b/src/com/android/settings/bluetooth/HeadsetProfile.java
index 1caeb65..45b81ab 100755
--- a/src/com/android/settings/bluetooth/HeadsetProfile.java
+++ b/src/com/android/settings/bluetooth/HeadsetProfile.java
@@ -115,7 +115,7 @@ final class HeadsetProfile implements LocalBluetoothProfile {
List<BluetoothDevice> sinks = mService.getConnectedDevices();
if (sinks != null) {
for (BluetoothDevice sink : sinks) {
- mService.disconnect(sink);
+ Log.d(TAG,"Not disconnecting device = " + sink);
}
}
return mService.connect(device);
@@ -124,24 +124,33 @@ final class HeadsetProfile implements LocalBluetoothProfile {
public boolean disconnect(BluetoothDevice device) {
if (mService == null) return false;
List<BluetoothDevice> deviceList = mService.getConnectedDevices();
- if (!deviceList.isEmpty() && deviceList.get(0).equals(device)) {
- // Downgrade priority as user is disconnecting the headset.
- if (mService.getPriority(device) > BluetoothProfile.PRIORITY_ON) {
- mService.setPriority(device, BluetoothProfile.PRIORITY_ON);
+ if (!deviceList.isEmpty()) {
+ for (BluetoothDevice dev : deviceList) {
+ if (dev.equals(device)) {
+ if (V) Log.d(TAG,"Downgrade priority as user" +
+ "is disconnecting the headset");
+ // Downgrade priority as user is disconnecting the headset.
+ if (mService.getPriority(device) > BluetoothProfile.PRIORITY_ON) {
+ mService.setPriority(device, BluetoothProfile.PRIORITY_ON);
+ }
+ return mService.disconnect(device);
+ }
}
- return mService.disconnect(device);
- } else {
- return false;
}
+ return false;
}
public int getConnectionStatus(BluetoothDevice device) {
if (mService == null) return BluetoothProfile.STATE_DISCONNECTED;
List<BluetoothDevice> deviceList = mService.getConnectedDevices();
-
- return !deviceList.isEmpty() && deviceList.get(0).equals(device)
- ? mService.getConnectionState(device)
- : BluetoothProfile.STATE_DISCONNECTED;
+ if (!deviceList.isEmpty()){
+ for (BluetoothDevice dev : deviceList) {
+ if (dev.equals(device)) {
+ return mService.getConnectionState(device);
+ }
+ }
+ }
+ return BluetoothProfile.STATE_DISCONNECTED;
}
public boolean isPreferred(BluetoothDevice device) {