From 5c095e59f679f726df1b6655fbbd73e310ac0dec Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 25 Jul 2013 19:00:45 +0900 Subject: [PATCH] Cancel all ongoing event when onFinishInputView Bug: 9334755 Change-Id: If0c2ac49a50f4a529aefeca603569f9413367469 --- .../inputmethod/keyboard/MainKeyboardView.java | 11 +++++++---- .../android/inputmethod/keyboard/PointerTracker.java | 8 ++++++-- .../keyboard/internal/PointerTrackerQueue.java | 2 +- java/src/com/android/inputmethod/latin/LatinIME.java | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index f67981e8b..6aa43b994 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -1206,15 +1206,18 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack eventTag + eventTime + "," + id + "," + x + "," + y + "," + size + "," + pressure); } - public void cancelAllMessages() { + public void cancelAllOngoingEvents() { mKeyTimerHandler.cancelAllMessages(); mDrawingHandler.cancelAllMessages(); + dismissAllKeyPreviews(); + dismissGestureFloatingPreviewText(); + dismissSlidingKeyInputPreview(); + PointerTracker.dismissAllMoreKeysPanels(); + PointerTracker.cancelAllPointerTrackers(); } public void closing() { - dismissAllKeyPreviews(); - cancelAllMessages(); - PointerTracker.dismissAllMoreKeysPanels(); + cancelAllOngoingEvents(); mMoreKeysKeyboardCache.clear(); } diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index a1cac3f11..c7b096430 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -413,6 +413,10 @@ public final class PointerTracker implements PointerTrackerQueue.Element { return sPointerTrackerQueue.isAnyInSlidingKeyInput(); } + public static void cancelAllPointerTrackers() { + sPointerTrackerQueue.cancelAllPointerTrackers(); + } + public static void setKeyboardActionListener(final KeyboardActionListener listener) { final int trackersSize = sTrackers.size(); for (int i = 0; i < trackersSize; ++i) { @@ -833,7 +837,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { } private void cancelBatchInput() { - sPointerTrackerQueue.cancelAllPointerTracker(); + cancelAllPointerTrackers(); mIsDetectingGesture = false; if (!sInGesture) { return; @@ -1273,7 +1277,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { } cancelBatchInput(); - sPointerTrackerQueue.cancelAllPointerTracker(); + cancelAllPointerTrackers(); sPointerTrackerQueue.releaseAllPointers(eventTime); onCancelEventInternal(); } diff --git a/java/src/com/android/inputmethod/keyboard/internal/PointerTrackerQueue.java b/java/src/com/android/inputmethod/keyboard/internal/PointerTrackerQueue.java index 3dbb7b7e9..7ee45e8f6 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/PointerTrackerQueue.java +++ b/java/src/com/android/inputmethod/keyboard/internal/PointerTrackerQueue.java @@ -207,7 +207,7 @@ public final class PointerTrackerQueue { } } - public void cancelAllPointerTracker() { + public void cancelAllPointerTrackers() { synchronized (mExpandableArrayOfActivePointers) { if (DEBUG) { Log.d(TAG, "cancelAllPointerTracker: " + this); diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index ef8a1c80c..6384ef74d 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -886,7 +886,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mKeyboardSwitcher.onFinishInputView(); final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); if (mainKeyboardView != null) { - mainKeyboardView.cancelAllMessages(); + mainKeyboardView.cancelAllOngoingEvents(); } // Remove pending messages related to update suggestions mHandler.cancelUpdateSuggestionStrip();