am 11b97c50: Merge change I551ed729 into eclair

Merge commit '11b97c50e6fb6d723e88eac3c125b60ca42184f7' into eclair-plus-aosp

* commit '11b97c50e6fb6d723e88eac3c125b60ca42184f7':
  Use UNDEFINED priorities when unpaired.
This commit is contained in:
Jaikumar Ganesh
2009-12-21 14:19:50 -08:00
committed by Android Git Automerger
3 changed files with 8 additions and 2 deletions

View File

@ -83,6 +83,8 @@ public final class BluetoothA2dp {
/** Default priority for a2dp devices that should not allow incoming /** Default priority for a2dp devices that should not allow incoming
* connections */ * connections */
public static final int PRIORITY_OFF = 0; public static final int PRIORITY_OFF = 0;
/** Default priority when not set or when the device is unpaired */
public static final int PRIORITY_UNDEFINED = -1;
private final IBluetoothA2dp mService; private final IBluetoothA2dp mService;
private final Context mContext; private final Context mContext;

View File

@ -109,6 +109,8 @@ public final class BluetoothHeadset {
/** Default priority for headsets that should not be auto-connected /** Default priority for headsets that should not be auto-connected
* and not allow incoming connections. */ * and not allow incoming connections. */
public static final int PRIORITY_OFF = 0; public static final int PRIORITY_OFF = 0;
/** Default priority when not set or when the device is unpaired */
public static final int PRIORITY_UNDEFINED = -1;
/** The voice dialer 'works' but the user experience is poor. The voice /** The voice dialer 'works' but the user experience is poor. The voice
* recognizer has trouble dealing with the 8kHz SCO signal, and it still * recognizer has trouble dealing with the 8kHz SCO signal, and it still

View File

@ -96,11 +96,13 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
BluetoothDevice.ERROR); BluetoothDevice.ERROR);
switch(bondState) { switch(bondState) {
case BluetoothDevice.BOND_BONDED: case BluetoothDevice.BOND_BONDED:
setSinkPriority(device, BluetoothA2dp.PRIORITY_ON); if (getSinkPriority(device) == BluetoothA2dp.PRIORITY_UNDEFINED) {
setSinkPriority(device, BluetoothA2dp.PRIORITY_ON);
}
break; break;
case BluetoothDevice.BOND_BONDING: case BluetoothDevice.BOND_BONDING:
case BluetoothDevice.BOND_NONE: case BluetoothDevice.BOND_NONE:
setSinkPriority(device, BluetoothA2dp.PRIORITY_OFF); setSinkPriority(device, BluetoothA2dp.PRIORITY_UNDEFINED);
break; break;
} }
} else if (action.equals(BluetoothDevice.ACTION_ACL_CONNECTED)) { } else if (action.equals(BluetoothDevice.ACTION_ACL_CONNECTED)) {