aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-11-27 16:49:30 +0900
committerJean Chalard <jchalard@google.com>2013-11-27 17:37:57 +0900
commitdfc5aade2d9e33c48cd0a6c89eadd2fcbf69c52f (patch)
tree3bd4ba229fdf6d6a168453bb9d6551cd7668b416 /java
parentfd15afae4623e1583bab771b40ee853709175385 (diff)
downloadlatinime-dfc5aade2d9e33c48cd0a6c89eadd2fcbf69c52f.tar.gz
latinime-dfc5aade2d9e33c48cd0a6c89eadd2fcbf69c52f.tar.xz
latinime-dfc5aade2d9e33c48cd0a6c89eadd2fcbf69c52f.zip
Fix messages in tests
They are not failing because of this right now, but future tests would fail without this. Concretely, since the Handler for any given main thread is a singleton managed by the framework, the messages won't be removed automatically. In particular, messages posted with a delay have a large destructive potential, because they will go through before the startInputViewInternal method is called, because it's called with a message too (in turn, this is because of working around framework bugs). Bug: 11142685 Change-Id: If81a168efcfd7d93806ddc4ea432d438c45a3e1d
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 59d0e9fbd..2e5bb19d6 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -233,6 +233,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private static final int MSG_REOPEN_DICTIONARIES = 5;
private static final int MSG_ON_END_BATCH_INPUT = 6;
private static final int MSG_RESET_CACHES = 7;
+ // Update this when adding new messages
+ private static final int MSG_LAST = MSG_RESET_CACHES;
private static final int ARG1_NOT_GESTURE_INPUT = 0;
private static final int ARG1_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT = 1;
@@ -344,6 +346,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
removeMessages(MSG_UPDATE_SHIFT_STATE);
}
+ @UsedForTesting
+ public void removeAllMessages() {
+ for (int i = 0; i <= MSG_LAST; ++i) {
+ removeMessages(i);
+ }
+ }
+
public void showGesturePreviewAndSuggestionStrip(final SuggestedWords suggestedWords,
final boolean dismissGestureFloatingPreviewText) {
removeMessages(MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP);