am d17eb48e: am 1308453b: b/2652059 Fixed the broken BT connects/disconnects after unpair

Merge commit 'd17eb48e9c87e02cbcb42899915dbfc921075231' into kraken

* commit 'd17eb48e9c87e02cbcb42899915dbfc921075231':
  b/2652059 Fixed the broken BT connects/disconnects after unpair
This commit is contained in:
Michael Chan
2010-05-04 12:45:29 -07:00
committed by Android Git Automerger

View File

@@ -749,7 +749,33 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
public void onBondingStateChanged(int bondState) { public void onBondingStateChanged(int bondState) {
if (bondState == BluetoothDevice.BOND_NONE) { if (bondState == BluetoothDevice.BOND_NONE) {
mProfiles.clear(); mProfiles.clear();
BluetoothJob job = workQueue.peek();
if (job == null) {
return;
}
// Remove the first item and process the next one
if (job.command == BluetoothCommand.REMOVE_BOND
&& job.cachedDevice.mDevice.equals(mDevice)) {
workQueue.poll(); // dequeue
} else {
// Unexpected job
if (D) {
Log.d(TAG, "job.command = " + job.command);
Log.d(TAG, "mDevice:" + mDevice + " != head:" + job.toString());
}
// Check to see if we need to remove the stale items from the queue
if (!pruneQueue(null)) {
// nothing in the queue was modify. Just ignore the notification and return.
return;
}
}
processCommands();
} }
refresh(); refresh();
} }