Merge "Cancel keydown events immediately once the view starts scrolling"
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index 19aef14..b5d82fa 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -412,13 +412,9 @@
         final int keyWidth = mKeyboard.mMostCommonKeyWidth;
         final int keyHeight = mKeyboard.mMostCommonKeyHeight;
         mBatchInputArbiter.setKeyboardGeometry(keyWidth, mKeyboard.mOccupiedHeight);
-        final Key newKey = mKeyDetector.detectHitKey(mKeyX, mKeyY);
-        if (newKey != mCurrentKey) {
-            if (sDrawingProxy != null) {
-                setReleasedKeyGraphics(mCurrentKey);
-            }
-            // Keep {@link #mCurrentKey} that comes from previous keyboard.
-        }
+        // Keep {@link #mCurrentKey} that comes from previous keyboard. The key preview of
+        // {@link #mCurrentKey} will be dismissed by {@setReleasedKeyGraphics(Key)} via
+        // {@link onMoveEventInternal(int,int,long)} or {@link #onUpEventInternal(int,int,long)}.
         mPhantomSuddenMoveThreshold = (int)(keyWidth * PHANTOM_SUDDEN_MOVE_THRESHOLD);
         mBogusMoveEventDetector.setKeyboardGeometry(keyWidth, keyHeight);
     }
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
index ff197ba..625d1f0 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
@@ -101,10 +101,11 @@
             if (tag instanceof KeyPreviewAnimations) {
                 final KeyPreviewAnimations animation = (KeyPreviewAnimations)tag;
                 animation.startDismiss();
+                return;
             }
-            return;
         }
         // Dismiss preview without animation.
+        mShowingKeyPreviewTextViews.remove(key);
         if (tag instanceof Animator) {
             ((Animator)tag).cancel();
         }