From b1e6eeea57794518997f449a4e4b947be4f74b0e Mon Sep 17 00:00:00 2001
From: Jean Chalard <jchalard@google.com>
Date: Tue, 1 Oct 2013 19:54:14 +0900
Subject: [PATCH] Fix a bug where gesture would delay update.

Change-Id: I94c394f45f2717bc1a4b95692a5757c1e7179152
---
 .../com/android/inputmethod/keyboard/PointerTracker.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index ee4ac950cd..52f190e773 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -823,14 +823,16 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
             final int size = sAggregratedPointers.getPointerSize();
             if (size > sLastRecognitionPointSize
                     && stroke.hasRecognitionTimePast(eventTime, sLastRecognitionTime)) {
-                sLastRecognitionPointSize = size;
-                sLastRecognitionTime = eventTime;
                 if (DEBUG_LISTENER) {
                     Log.d(TAG, String.format("[%d] onUpdateBatchInput: batchPoints=%d", mPointerId,
                             size));
                 }
                 mTimerProxy.startUpdateBatchInputTimer(this);
                 mListener.onUpdateBatchInput(sAggregratedPointers);
+                // The listener may change the size of the pointers (when auto-committing
+                // for example), so we need to get the size from the pointers again.
+                sLastRecognitionPointSize = sAggregratedPointers.getPointerSize();
+                sLastRecognitionTime = eventTime;
             }
         }
     }
-- 
GitLab