From 7c1e853387f71235fd0bd8051246f7a95be5ed53 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 21 Dec 2012 14:14:09 +0900 Subject: [PATCH] Call onCancelBatchInput only when onStartBatchInput has been called This NPE issue (Bug: 7903331) has been introduced by Ie68c7698. Bug: 7903331 Change-Id: I44884f5608fe47d9db7a2c93a752d17b9ae39a22 --- .../com/android/inputmethod/keyboard/PointerTracker.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index 0f55607a0..59a3c99aa 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -791,6 +791,9 @@ public final class PointerTracker implements PointerTrackerQueue.Element { private void cancelBatchInput() { sPointerTrackerQueue.cancelAllPointerTracker(); + if (!sInGesture) { + return; + } sInGesture = false; if (DEBUG_LISTENER) { Log.d(TAG, String.format("[%d] onCancelBatchInput", mPointerId)); @@ -1208,9 +1211,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { printTouchEvent("onCancelEvt:", x, y, eventTime); } - if (sInGesture) { - cancelBatchInput(); - } + cancelBatchInput(); sPointerTrackerQueue.cancelAllPointerTracker(); sPointerTrackerQueue.releaseAllPointers(eventTime); onCancelEventInternal();