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); } return mService.disconnect(device); }
public void setPreferred(BluetoothDevice device, boolean preferred) { if (mService == null) return; if (preferred) { if (mService.getPriority(device) < BluetoothProfile.PRIORITY_ON) { mService.setPriority(device, BluetoothProfile.PRIORITY_ON); } } else { mService.setPriority(device, BluetoothProfile.PRIORITY_OFF); } }
public int getPreferred(BluetoothDevice device) { if (mService == null) return BluetoothProfile.PRIORITY_OFF; return mService.getPriority(device); }
public boolean isPreferred(BluetoothDevice device) { if (mService == null) return false; return mService.getPriority(device) > BluetoothProfile.PRIORITY_OFF; }