summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAjay Panicker <apanicke@google.com>2015-08-26 14:06:34 -0700
committerAndre Eisenbach <eisenbach@google.com>2015-08-26 19:34:52 -0700
commitc211978650580904a4b11b7c5b899e9d2f7ed294 (patch)
treee612fe4d28b163ec9ee3d4d155d05fdf1556d8eb
parent8f1ea834f9af5ccf6cea1f529f63e727cd13b6a8 (diff)
downloadframeworks_base-c211978650580904a4b11b7c5b899e9d2f7ed294.zip
frameworks_base-c211978650580904a4b11b7c5b899e9d2f7ed294.tar.gz
frameworks_base-c211978650580904a4b11b7c5b899e9d2f7ed294.tar.bz2
Add StateMachine.removeDeferredMessages()
Bug: 23111466 Change-Id: Ifbb67d4eb080313af0968d5cb6b9508837e3458e
-rw-r--r--core/java/com/android/internal/util/StateMachine.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/java/com/android/internal/util/StateMachine.java b/core/java/com/android/internal/util/StateMachine.java
index 916f19d..447292c 100644
--- a/core/java/com/android/internal/util/StateMachine.java
+++ b/core/java/com/android/internal/util/StateMachine.java
@@ -29,6 +29,7 @@ import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
+import java.util.Iterator;
import java.util.HashMap;
import java.util.Vector;
@@ -1864,6 +1865,20 @@ public class StateMachine {
}
/**
+ * Removes a message from the deferred messages queue.
+ */
+ protected final void removeDeferredMessages(int what) {
+ SmHandler smh = mSmHandler;
+ if (smh == null) return;
+
+ Iterator<Message> iterator = smh.mDeferredMessages.iterator();
+ while (iterator.hasNext()) {
+ Message msg = iterator.next();
+ if (msg.what == what) iterator.remove();
+ }
+ }
+
+ /**
* Validate that the message was sent by
* {@link StateMachine#quit} or {@link StateMachine#quitNow}.
* */