diff options
author | Gaurav Asati <gasati@codeaurora.org> | 2015-07-28 20:57:29 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:27:02 -0600 |
commit | 71d6acbfd1a726e8722e4e0f32f20b7bb21b6656 (patch) | |
tree | 5dc8883e45ec29617848813d2eb67ef327d31a3f /packages/SettingsLib | |
parent | 620c100fe78ccfd67d3ea1aa230c772d32d96e60 (diff) | |
download | frameworks_base-71d6acbfd1a726e8722e4e0f32f20b7bb21b6656.zip frameworks_base-71d6acbfd1a726e8722e4e0f32f20b7bb21b6656.tar.gz frameworks_base-71d6acbfd1a726e8722e4e0f32f20b7bb21b6656.tar.bz2 |
BT: Multi A2dp support in Settings App.
1. The connected sinks are not disconnected from
A2dpProfile when new sink is connecting.
2. Also return correct connection status for
specific HS.
3. Sets priority for specific HS while disconnecting.
Change-Id: I56142d1527aa86d2bb47fb7166b2f3ab451d9b17
Bluetooth: Add support of two A2dp connections.
Audio Service will now manage two a2dp connections
and makes sure that BT a2dp connections are
consistently seen by other applications.
The change removes the BD address usage in BT
names, and uses a new Strin "BluetoothA2dp"
in order to show A2dp connected devices.
Change-Id: I59b8f8eff7bbc8033fcd46d0ac21d94ee338ca36
Diffstat (limited to 'packages/SettingsLib')
-rw-r--r--[-rwxr-xr-x] | packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java index 9608daa..873d392 100755..100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java @@ -116,7 +116,11 @@ public final class A2dpProfile implements LocalBluetoothProfile { List<BluetoothDevice> sinks = getConnectedDevices(); if (sinks != null) { for (BluetoothDevice sink : sinks) { - mService.disconnect(sink); + if (sink.equals(device)) { + // Connect to same device, Ignore it + Log.d(TAG,"Not disconnecting device = " + sink); + return true; + } } } return mService.connect(device); @@ -124,18 +128,36 @@ public final class A2dpProfile implements LocalBluetoothProfile { public boolean disconnect(BluetoothDevice device) { if (mService == null) return false; - // Downgrade priority as user is disconnecting the headset. - if (mService.getPriority(device) > BluetoothProfile.PRIORITY_ON){ - mService.setPriority(device, BluetoothProfile.PRIORITY_ON); + List<BluetoothDevice> deviceList = mService.getConnectedDevices(); + 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); + return false; } public int getConnectionStatus(BluetoothDevice device) { if (mService == null) { return BluetoothProfile.STATE_DISCONNECTED; } - return mService.getConnectionState(device); + List<BluetoothDevice> deviceList = mService.getConnectedDevices(); + if (!deviceList.isEmpty()) { + for (BluetoothDevice dev : deviceList) { + if (dev.equals(device)) { + return mService.getConnectionState(device); + } + } + } + return BluetoothProfile.STATE_DISCONNECTED; } public boolean isPreferred(BluetoothDevice device) { |