Merge "DO NOT MERGE Add null check before disconnecting a device." into gingerbread

This commit is contained in:
Jaikumar Ganesh
2010-10-13 11:09:35 -07:00
committed by Android (Google) Code Review

View File

@@ -379,7 +379,8 @@ public abstract class LocalBluetoothProfileManager {
@Override
public boolean disconnect(BluetoothDevice device) {
if (mService.getCurrentHeadset().equals(device)) {
BluetoothDevice currDevice = mService.getCurrentHeadset();
if (currDevice != null && currDevice.equals(device)) {
// Downgrade prority as user is disconnecting the headset.
if (mService.getPriority(device) > BluetoothHeadset.PRIORITY_ON) {
mService.setPriority(device, BluetoothHeadset.PRIORITY_ON);