Loading java/src/com/android/inputmethod/keyboard/PointerTracker.java +28 −20 Original line number Diff line number Diff line Loading @@ -318,8 +318,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element { // true if keyboard layout has been changed. private boolean mKeyboardLayoutHasBeenChanged; // true if this pointer is no longer tracking touch event. private boolean mIsTrackingCanceled; // true if this pointer is no longer triggering any action because it has been canceled. private boolean mIsTrackingForActionDisabled; // the more keys panel currently being shown. equals null if no panel is active. private MoreKeysPanel mMoreKeysPanel; Loading Loading @@ -441,7 +441,11 @@ public final class PointerTracker implements PointerTrackerQueue.Element { // Returns true if keyboard has been changed by this callback. private boolean callListenerOnPressAndCheckKeyboardLayoutChange(final Key key) { if (sInGesture || mIsDetectingGesture) { // While gesture input is going on, this method should be a no-operation. But when gesture // input has been canceled, <code>sInGesture</code> and <code>mIsDetectingGesture</code> // are set to false. To keep this method is a no-operation, // <code>mIsTrackingForActionDisabled</code> should also be taken account of. if (sInGesture || mIsDetectingGesture || mIsTrackingForActionDisabled) { return false; } final boolean ignoreModifierKey = mIsInSlidingKeyInput && key.isModifier(); Loading Loading @@ -500,7 +504,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element { // primaryCode is different from {@link Key#mCode}. private void callListenerOnRelease(final Key key, final int primaryCode, final boolean withSliding) { if (sInGesture || mIsDetectingGesture) { // See the comment at {@link #callListenerOnPressAndCheckKeyboardLayoutChange(Key}}. if (sInGesture || mIsDetectingGesture || mIsTrackingForActionDisabled) { return; } final boolean ignoreModifierKey = mIsInSlidingKeyInput && key.isModifier(); Loading Loading @@ -745,7 +750,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { if (key != null) { updateBatchInput(eventTime); } if (mIsTrackingCanceled) { if (mIsTrackingForActionDisabled) { return; } mDrawingProxy.showGesturePreviewTrail(this); Loading Loading @@ -777,7 +782,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { sInGesture = false; sTimeRecorder.onEndBatchInput(eventTime); mTimerProxy.cancelAllUpdateBatchInputTimers(); if (!mIsTrackingCanceled) { if (!mIsTrackingForActionDisabled) { if (DEBUG_LISTENER) { Log.d(TAG, String.format("[%d] onEndBatchInput : batchPoints=%d", mPointerId, sAggregratedPointers.getPointerSize())); Loading @@ -786,7 +791,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { } } } if (mIsTrackingCanceled) { if (mIsTrackingForActionDisabled) { return; } mDrawingProxy.showGesturePreviewTrail(this); Loading Loading @@ -846,7 +851,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.pointerTracker_onDownEvent(deltaT, distance * distance); } cancelTracking(); cancelTrackingForAction(); return; } } Loading Loading @@ -887,7 +892,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { || (key != null && key.isModifier()) || mKeyDetector.alwaysAllowsSlidingInput(); mKeyboardLayoutHasBeenChanged = false; mIsTrackingCanceled = false; mIsTrackingForActionDisabled = false; resetSlidingKeyInput(); if (key != null) { // This onPress call may have changed keyboard layout. Those cases are detected at Loading Loading @@ -947,7 +952,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { if (DEBUG_MOVE_EVENT) { printTouchEvent("onMoveEvent:", x, y, eventTime); } if (mIsTrackingCanceled) { if (mIsTrackingForActionDisabled) { return; } Loading Loading @@ -985,6 +990,9 @@ public final class PointerTracker implements PointerTrackerQueue.Element { key = onMoveKey(x, y); } onMoveToNewKey(key, x, y); if (mIsTrackingForActionDisabled) { return; } startLongPressTimer(key); setPressedKeyGraphics(key, eventTime); } Loading Loading @@ -1069,11 +1077,11 @@ public final class PointerTracker implements PointerTrackerQueue.Element { + " detected sliding finger while multi touching", mPointerId)); } onUpEvent(x, y, eventTime); cancelTracking(); cancelTrackingForAction(); setReleasedKeyGraphics(oldKey); } else { if (!mIsDetectingGesture) { cancelTracking(); cancelTrackingForAction(); } setReleasedKeyGraphics(oldKey); } Loading @@ -1087,7 +1095,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { onMoveToNewKey(null, x, y); } else { if (!mIsDetectingGesture) { cancelTracking(); cancelTrackingForAction(); } } } Loading Loading @@ -1155,7 +1163,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { return; } onUpEventInternal(mLastX, mLastY, eventTime); cancelTracking(); cancelTrackingForAction(); } private void onUpEventInternal(final int x, final int y, final long eventTime) { Loading @@ -1168,7 +1176,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { setReleasedKeyGraphics(currentKey); if (isShowingMoreKeysPanel()) { if (!mIsTrackingCanceled) { if (!mIsTrackingForActionDisabled) { final int translatedX = mMoreKeysPanel.translateX(x); final int translatedY = mMoreKeysPanel.translateY(y); mMoreKeysPanel.onUpEvent(translatedX, translatedY, mPointerId, eventTime); Loading @@ -1186,7 +1194,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { return; } if (mIsTrackingCanceled) { if (mIsTrackingForActionDisabled) { return; } if (currentKey != null && !currentKey.isRepeatable()) { Loading @@ -1203,16 +1211,16 @@ public final class PointerTracker implements PointerTrackerQueue.Element { } @Override public void cancelTracking() { public void cancelTrackingForAction() { if (isShowingMoreKeysPanel()) { return; } mIsTrackingCanceled = true; mIsTrackingForActionDisabled = true; } public void onLongPressed() { resetSlidingKeyInput(); cancelTracking(); cancelTrackingForAction(); setReleasedKeyGraphics(mCurrentKey); sPointerTrackerQueue.remove(this); } Loading Loading @@ -1316,6 +1324,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element { final Key key = mKeyDetector.detectHitKey(x, y); final String code = KeyDetector.printableCode(key); Log.d(TAG, String.format("[%d]%s%s %4d %4d %5d %s", mPointerId, (mIsTrackingCanceled ? "-" : " "), title, x, y, eventTime, code)); (mIsTrackingForActionDisabled ? "-" : " "), title, x, y, eventTime, code)); } } java/src/com/android/inputmethod/keyboard/internal/PointerTrackerQueue.java +2 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ public final class PointerTrackerQueue { public boolean isModifier(); public boolean isInSlidingKeyInput(); public void onPhantomUpEvent(long eventTime); public void cancelTracking(); public void cancelTrackingForAction(); } private static final int INITIAL_CAPACITY = 10; Loading Loading @@ -206,7 +206,7 @@ public final class PointerTrackerQueue { final int arraySize = mArraySize; for (int index = 0; index < arraySize; index++) { final Element element = expandableArray.get(index); element.cancelTracking(); element.cancelTrackingForAction(); } } } Loading tests/src/com/android/inputmethod/keyboard/internal/PointerTrackerQueueTests.java +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase { } @Override public void cancelTracking() {} public void cancelTrackingForAction() {} @Override public String toString() { Loading Loading
java/src/com/android/inputmethod/keyboard/PointerTracker.java +28 −20 Original line number Diff line number Diff line Loading @@ -318,8 +318,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element { // true if keyboard layout has been changed. private boolean mKeyboardLayoutHasBeenChanged; // true if this pointer is no longer tracking touch event. private boolean mIsTrackingCanceled; // true if this pointer is no longer triggering any action because it has been canceled. private boolean mIsTrackingForActionDisabled; // the more keys panel currently being shown. equals null if no panel is active. private MoreKeysPanel mMoreKeysPanel; Loading Loading @@ -441,7 +441,11 @@ public final class PointerTracker implements PointerTrackerQueue.Element { // Returns true if keyboard has been changed by this callback. private boolean callListenerOnPressAndCheckKeyboardLayoutChange(final Key key) { if (sInGesture || mIsDetectingGesture) { // While gesture input is going on, this method should be a no-operation. But when gesture // input has been canceled, <code>sInGesture</code> and <code>mIsDetectingGesture</code> // are set to false. To keep this method is a no-operation, // <code>mIsTrackingForActionDisabled</code> should also be taken account of. if (sInGesture || mIsDetectingGesture || mIsTrackingForActionDisabled) { return false; } final boolean ignoreModifierKey = mIsInSlidingKeyInput && key.isModifier(); Loading Loading @@ -500,7 +504,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element { // primaryCode is different from {@link Key#mCode}. private void callListenerOnRelease(final Key key, final int primaryCode, final boolean withSliding) { if (sInGesture || mIsDetectingGesture) { // See the comment at {@link #callListenerOnPressAndCheckKeyboardLayoutChange(Key}}. if (sInGesture || mIsDetectingGesture || mIsTrackingForActionDisabled) { return; } final boolean ignoreModifierKey = mIsInSlidingKeyInput && key.isModifier(); Loading Loading @@ -745,7 +750,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { if (key != null) { updateBatchInput(eventTime); } if (mIsTrackingCanceled) { if (mIsTrackingForActionDisabled) { return; } mDrawingProxy.showGesturePreviewTrail(this); Loading Loading @@ -777,7 +782,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { sInGesture = false; sTimeRecorder.onEndBatchInput(eventTime); mTimerProxy.cancelAllUpdateBatchInputTimers(); if (!mIsTrackingCanceled) { if (!mIsTrackingForActionDisabled) { if (DEBUG_LISTENER) { Log.d(TAG, String.format("[%d] onEndBatchInput : batchPoints=%d", mPointerId, sAggregratedPointers.getPointerSize())); Loading @@ -786,7 +791,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { } } } if (mIsTrackingCanceled) { if (mIsTrackingForActionDisabled) { return; } mDrawingProxy.showGesturePreviewTrail(this); Loading Loading @@ -846,7 +851,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.pointerTracker_onDownEvent(deltaT, distance * distance); } cancelTracking(); cancelTrackingForAction(); return; } } Loading Loading @@ -887,7 +892,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { || (key != null && key.isModifier()) || mKeyDetector.alwaysAllowsSlidingInput(); mKeyboardLayoutHasBeenChanged = false; mIsTrackingCanceled = false; mIsTrackingForActionDisabled = false; resetSlidingKeyInput(); if (key != null) { // This onPress call may have changed keyboard layout. Those cases are detected at Loading Loading @@ -947,7 +952,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { if (DEBUG_MOVE_EVENT) { printTouchEvent("onMoveEvent:", x, y, eventTime); } if (mIsTrackingCanceled) { if (mIsTrackingForActionDisabled) { return; } Loading Loading @@ -985,6 +990,9 @@ public final class PointerTracker implements PointerTrackerQueue.Element { key = onMoveKey(x, y); } onMoveToNewKey(key, x, y); if (mIsTrackingForActionDisabled) { return; } startLongPressTimer(key); setPressedKeyGraphics(key, eventTime); } Loading Loading @@ -1069,11 +1077,11 @@ public final class PointerTracker implements PointerTrackerQueue.Element { + " detected sliding finger while multi touching", mPointerId)); } onUpEvent(x, y, eventTime); cancelTracking(); cancelTrackingForAction(); setReleasedKeyGraphics(oldKey); } else { if (!mIsDetectingGesture) { cancelTracking(); cancelTrackingForAction(); } setReleasedKeyGraphics(oldKey); } Loading @@ -1087,7 +1095,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { onMoveToNewKey(null, x, y); } else { if (!mIsDetectingGesture) { cancelTracking(); cancelTrackingForAction(); } } } Loading Loading @@ -1155,7 +1163,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { return; } onUpEventInternal(mLastX, mLastY, eventTime); cancelTracking(); cancelTrackingForAction(); } private void onUpEventInternal(final int x, final int y, final long eventTime) { Loading @@ -1168,7 +1176,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { setReleasedKeyGraphics(currentKey); if (isShowingMoreKeysPanel()) { if (!mIsTrackingCanceled) { if (!mIsTrackingForActionDisabled) { final int translatedX = mMoreKeysPanel.translateX(x); final int translatedY = mMoreKeysPanel.translateY(y); mMoreKeysPanel.onUpEvent(translatedX, translatedY, mPointerId, eventTime); Loading @@ -1186,7 +1194,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { return; } if (mIsTrackingCanceled) { if (mIsTrackingForActionDisabled) { return; } if (currentKey != null && !currentKey.isRepeatable()) { Loading @@ -1203,16 +1211,16 @@ public final class PointerTracker implements PointerTrackerQueue.Element { } @Override public void cancelTracking() { public void cancelTrackingForAction() { if (isShowingMoreKeysPanel()) { return; } mIsTrackingCanceled = true; mIsTrackingForActionDisabled = true; } public void onLongPressed() { resetSlidingKeyInput(); cancelTracking(); cancelTrackingForAction(); setReleasedKeyGraphics(mCurrentKey); sPointerTrackerQueue.remove(this); } Loading Loading @@ -1316,6 +1324,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element { final Key key = mKeyDetector.detectHitKey(x, y); final String code = KeyDetector.printableCode(key); Log.d(TAG, String.format("[%d]%s%s %4d %4d %5d %s", mPointerId, (mIsTrackingCanceled ? "-" : " "), title, x, y, eventTime, code)); (mIsTrackingForActionDisabled ? "-" : " "), title, x, y, eventTime, code)); } }
java/src/com/android/inputmethod/keyboard/internal/PointerTrackerQueue.java +2 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ public final class PointerTrackerQueue { public boolean isModifier(); public boolean isInSlidingKeyInput(); public void onPhantomUpEvent(long eventTime); public void cancelTracking(); public void cancelTrackingForAction(); } private static final int INITIAL_CAPACITY = 10; Loading Loading @@ -206,7 +206,7 @@ public final class PointerTrackerQueue { final int arraySize = mArraySize; for (int index = 0; index < arraySize; index++) { final Element element = expandableArray.get(index); element.cancelTracking(); element.cancelTrackingForAction(); } } } Loading
tests/src/com/android/inputmethod/keyboard/internal/PointerTrackerQueueTests.java +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase { } @Override public void cancelTracking() {} public void cancelTrackingForAction() {} @Override public String toString() { Loading