From d2c81986c236ed680cfae5e420561028ae4cc0d2 Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Fri, 7 May 2010 15:24:22 -0700 Subject: [PATCH] b/2652059 Refresh UI after bond state change Change-Id: I8f8a939ba3f383aae36091986cea4e8a6eae13fb --- .../bluetooth/CachedBluetoothDevice.java | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java index c724c331687..aa4a9584176 100644 --- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java +++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java @@ -751,29 +751,28 @@ public class CachedBluetoothDevice implements Comparable mProfiles.clear(); BluetoothJob job = workQueue.peek(); - if (job == null) { - return; - } + if (job != null) { + // 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()); + } - // 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. + refresh(); + return; + } } - // 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(); } - - processCommands(); } refresh();