diff options
| author | 2015-12-07 23:51:52 +0000 | |
|---|---|---|
| committer | 2015-12-07 23:51:52 +0000 | |
| commit | 547ef450bf12e07beafcef24c19f6f80ec9fd788 (patch) | |
| tree | f2764c225d45401458fbbe8acdbc424c2abcf09b | |
| parent | 51e3188dd9613055d475ec02822145a582d4d00b (diff) | |
| parent | 0dfeda60c06c7bdbb4fde197e50a4c46f4024bd7 (diff) | |
Merge "Adding StateMachine.hasMessages(), StateMachine.hasDeferredMessages()" into mnc-dr1.5-dev am: cd2cc9aa9b am: d515b124f7
am: 0dfeda60c0
* commit '0dfeda60c06c7bdbb4fde197e50a4c46f4024bd7':
Adding StateMachine.hasMessages(), StateMachine.hasDeferredMessages()
| -rw-r--r-- | core/java/com/android/internal/util/StateMachine.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/core/java/com/android/internal/util/StateMachine.java b/core/java/com/android/internal/util/StateMachine.java index 68166467c3a9..554d367f6cea 100644 --- a/core/java/com/android/internal/util/StateMachine.java +++ b/core/java/com/android/internal/util/StateMachine.java @@ -1879,6 +1879,33 @@ public class StateMachine { } /** + * Check if there are any pending messages with code 'what' in deferred messages queue. + */ + protected final boolean hasDeferredMessages(int what) { + SmHandler smh = mSmHandler; + if (smh == null) return false; + + Iterator<Message> iterator = smh.mDeferredMessages.iterator(); + while (iterator.hasNext()) { + Message msg = iterator.next(); + if (msg.what == what) return true; + } + + return false; + } + + /** + * Check if there are any pending posts of messages with code 'what' in + * the message queue. This does NOT check messages in deferred message queue. + */ + protected final boolean hasMessages(int what) { + SmHandler smh = mSmHandler; + if (smh == null) return false; + + return smh.hasMessages(what); + } + + /** * Validate that the message was sent by * {@link StateMachine#quit} or {@link StateMachine#quitNow}. * */ |