diff options
| author | Jaikumar Ganesh <jaikumar@google.com> | 2011-08-15 15:40:56 -0700 |
|---|---|---|
| committer | Jaikumar Ganesh <jaikumar@google.com> | 2011-08-15 16:41:08 -0700 |
| commit | 89d55ad781c6f1eba77342c89136dce41a7de72a (patch) | |
| tree | d0a46864e337e6fa6a5885f7a3cb00c0d53d2666 /core/java/android/server/BluetoothBondState.java | |
| parent | 152abefccb6925fd1092ac6424d7720b43375fc8 (diff) | |
| download | frameworks_base-89d55ad781c6f1eba77342c89136dce41a7de72a.zip frameworks_base-89d55ad781c6f1eba77342c89136dce41a7de72a.tar.gz frameworks_base-89d55ad781c6f1eba77342c89136dce41a7de72a.tar.bz2 | |
Fix stuck in pairing when BT is turned off.
When pairing is stuck, on turning BT off, we were
not setting the outgoing parining variable to null in
setBondState because of the extra check for isEnabled.
isEnabled check was added to prevent the proxy crash in
setProfilePriorities function. Proxies should never be null.
Add a safety check and also some extra logs to debug the problem.
Change-Id: I694dfeb8fa9426b3916775ca868c2313fa9c22ee
Diffstat (limited to 'core/java/android/server/BluetoothBondState.java')
| -rw-r--r-- | core/java/android/server/BluetoothBondState.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/core/java/android/server/BluetoothBondState.java b/core/java/android/server/BluetoothBondState.java index 6710aab..fbc1c27 100644 --- a/core/java/android/server/BluetoothBondState.java +++ b/core/java/android/server/BluetoothBondState.java @@ -134,7 +134,6 @@ class BluetoothBondState { /** reason is ignored unless state == BOND_NOT_BONDED */ public synchronized void setBondState(String address, int state, int reason) { if (DBG) Log.d(TAG, "setBondState " + "address" + " " + state + "reason: " + reason); - if (!mService.isEnabled()) return; int oldState = getBondState(address); if (oldState == state) { @@ -459,16 +458,26 @@ class BluetoothBondState { // intent reach them. But that left a small time gap that could reject // incoming connection due to undefined priorities. if (state == BluetoothDevice.BOND_BONDED) { - if (mA2dpProxy.getPriority(remoteDevice) == BluetoothProfile.PRIORITY_UNDEFINED) { + if (mA2dpProxy != null && + mA2dpProxy.getPriority(remoteDevice) == BluetoothProfile.PRIORITY_UNDEFINED) { mA2dpProxy.setPriority(remoteDevice, BluetoothProfile.PRIORITY_ON); } - if (mHeadsetProxy.getPriority(remoteDevice) == BluetoothProfile.PRIORITY_UNDEFINED) { + if (mHeadsetProxy != null && + mHeadsetProxy.getPriority(remoteDevice) == BluetoothProfile.PRIORITY_UNDEFINED) { mHeadsetProxy.setPriority(remoteDevice, BluetoothProfile.PRIORITY_ON); } } else if (state == BluetoothDevice.BOND_NONE) { - mA2dpProxy.setPriority(remoteDevice, BluetoothProfile.PRIORITY_UNDEFINED); - mHeadsetProxy.setPriority(remoteDevice, BluetoothProfile.PRIORITY_UNDEFINED); + if (mA2dpProxy != null) { + mA2dpProxy.setPriority(remoteDevice, BluetoothProfile.PRIORITY_UNDEFINED); + } + if (mHeadsetProxy != null) { + mHeadsetProxy.setPriority(remoteDevice, BluetoothProfile.PRIORITY_UNDEFINED); + } + } + + if (mA2dpProxy == null || mHeadsetProxy == null) { + Log.e(TAG, "Proxy is null:" + mA2dpProxy + ":" + mHeadsetProxy); } } |
