summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/bluetooth
diff options
context:
space:
mode:
authorNitin Srivastava <nitinsr@codeaurora.org>2014-07-31 01:51:34 +0530
committerMatthew Xie <mattx@google.com>2014-08-03 17:12:50 -0700
commitb0b9855e8001b7a747ca40986c86ab8ab64108b9 (patch)
tree25d5d24b1a3c0b04b8b5597452a81fb832487f25 /src/com/android/settings/bluetooth
parentca90af1064f966c1ef764a3388020c94ba4a1121 (diff)
downloadpackages_apps_Settings-b0b9855e8001b7a747ca40986c86ab8ab64108b9.zip
packages_apps_Settings-b0b9855e8001b7a747ca40986c86ab8ab64108b9.tar.gz
packages_apps_Settings-b0b9855e8001b7a747ca40986c86ab8ab64108b9.tar.bz2
Bluetooth: Multi HF support
1. The connected sinks are not disconnected from HeadsetProfile when new sink is connecting. 2. Also return correct connection status for specific HS. 3. Sets priority for specific HS while disconnecting. bug 16519158 Change-Id: I62c6629cf11129733aab8a835adcd51e014b3860
Diffstat (limited to 'src/com/android/settings/bluetooth')
-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) {