From 6e3ee10a99b4d71ffe8f2473dcb8c6dbf4da0ed5 Mon Sep 17 00:00:00 2001 From: Jaikumar Ganesh Date: Wed, 9 Dec 2009 19:15:30 -0800 Subject: [PATCH] Fix auto connection of A2DP profile. When the user selects profiles from the UI, set priority to ON. Dr No: Eastham Bug: 2317323 --- .../LocalBluetoothProfileManager.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java index b488c22e185..24ba04572d2 100644 --- a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java +++ b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java @@ -214,8 +214,13 @@ public abstract class LocalBluetoothProfileManager { @Override public void setPreferred(BluetoothDevice device, boolean preferred) { - mService.setSinkPriority(device, - preferred ? BluetoothA2dp.PRIORITY_AUTO_CONNECT : BluetoothA2dp.PRIORITY_OFF); + if (preferred) { + if (mService.getSinkPriority(device) < BluetoothA2dp.PRIORITY_ON) { + mService.setSinkPriority(device, BluetoothA2dp.PRIORITY_ON); + } + } else { + mService.setSinkPriority(device, BluetoothA2dp.PRIORITY_OFF); + } } @Override @@ -328,8 +333,13 @@ public abstract class LocalBluetoothProfileManager { @Override public void setPreferred(BluetoothDevice device, boolean preferred) { - mService.setPriority(device, - preferred ? BluetoothHeadset.PRIORITY_AUTO_CONNECT : BluetoothHeadset.PRIORITY_OFF); + if (preferred) { + if (mService.getPriority(device) < BluetoothHeadset.PRIORITY_ON) { + mService.setPriority(device, BluetoothHeadset.PRIORITY_ON); + } + } else { + mService.setPriority(device, BluetoothHeadset.PRIORITY_OFF); + } } @Override