From 9a1ed7e4e648c5be77c3cbaae4988c54c9b1c6fe Mon Sep 17 00:00:00 2001 From: Jaikumar Ganesh Date: Tue, 24 Nov 2009 14:43:45 -0800 Subject: [PATCH] Update to reflect new priorities for A2DP profile. DO NOT MERGE. 1. PRIORITY_OFF is when it is unchecked. 2. PRIORITY_ON is when it is checked. 3. PRIORITY_AUTO_CONNECT is when we want to auto connect. When the box is checked, we want to auto connect, so set the priority to AUTO_CONNECT. When the user disconnects, we set the priority back to PRIORITY_ON. Change priority for Headset profile on the same lines as A2DP profile. AUTO_CONNECT => we auto_connect. ON => Settings app box is checked and we allow incoming connections. OFF => Settings app check box is unchecked. Dr no: Eastham Bug: 2133530 --- .../settings/bluetooth/LocalBluetoothProfileManager.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java index a6258e24a2c..44e2be34728 100644 --- a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java +++ b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java @@ -176,6 +176,8 @@ public abstract class LocalBluetoothProfileManager { @Override public boolean disconnect(BluetoothDevice device) { + // Downgrade priority as user is disconnecting the sink. + mService.setSinkPriority(device, BluetoothA2dp.PRIORITY_ON); return mService.disconnectSink(device); } @@ -203,7 +205,7 @@ public abstract class LocalBluetoothProfileManager { @Override public void setPreferred(BluetoothDevice device, boolean preferred) { mService.setSinkPriority(device, - preferred ? BluetoothA2dp.PRIORITY_AUTO : BluetoothA2dp.PRIORITY_OFF); + preferred ? BluetoothA2dp.PRIORITY_AUTO_CONNECT : BluetoothA2dp.PRIORITY_OFF); } @Override @@ -269,6 +271,8 @@ public abstract class LocalBluetoothProfileManager { @Override public boolean disconnect(BluetoothDevice device) { if (mService.getCurrentHeadset().equals(device)) { + // Downgrade prority as user is disconnecting the headset. + mService.setPriority(device, BluetoothHeadset.PRIORITY_ON); return mService.disconnectHeadset(); } else { return false; @@ -302,7 +306,7 @@ public abstract class LocalBluetoothProfileManager { @Override public void setPreferred(BluetoothDevice device, boolean preferred) { mService.setPriority(device, - preferred ? BluetoothHeadset.PRIORITY_AUTO : BluetoothHeadset.PRIORITY_OFF); + preferred ? BluetoothHeadset.PRIORITY_AUTO_CONNECT : BluetoothHeadset.PRIORITY_OFF); } @Override