From bf538ab2c0650092a49423778385e4a9a759f970 Mon Sep 17 00:00:00 2001
From: "Tadashi G. Takaoka" <takaoka@google.com>
Date: Fri, 28 Sep 2012 16:13:14 +0900
Subject: [PATCH] Remove dead code for disabling gesture input after fast
 typing

Bug: 7218902
Change-Id: Iccc1d4cf0dd3ac84b30c68e11eee9a6ad89f14c4
---
 java/res/values/attrs.xml                       |  2 --
 java/res/values/config.xml                      |  1 -
 java/res/values/styles.xml                      |  1 -
 .../inputmethod/keyboard/MainKeyboardView.java  | 16 ----------------
 .../inputmethod/keyboard/PointerTracker.java    | 17 -----------------
 5 files changed, 37 deletions(-)

diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index acc5df2e5d..7e8c77e136 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -125,8 +125,6 @@
         <attr name="longPressShiftKeyTimeout" format="integer" />
         <!-- Ignore special key timeout while typing in millisecond. -->
         <attr name="ignoreAltCodeKeyTimeout" format="integer" />
-        <!-- Disable gesture input while fast typing timer in millisecond. -->
-        <attr name="disableGestureWhileFastTypingTimeout" format="integer" />
         <!-- More keys keyboard will shown at touched point. -->
         <attr name="showMoreKeysKeyboardAtTouchedPoint" format="boolean" />
     </declare-styleable>
diff --git a/java/res/values/config.xml b/java/res/values/config.xml
index 1f6adffbbe..8e2d43e4e0 100644
--- a/java/res/values/config.xml
+++ b/java/res/values/config.xml
@@ -66,7 +66,6 @@
     <!-- Long pressing shift will invoke caps-lock if > 0, never invoke caps-lock if == 0 -->
     <integer name="config_long_press_shift_key_timeout">1200</integer>
     <integer name="config_ignore_alt_code_key_timeout">350</integer>
-    <integer name="config_disable_gesture_while_fast_typing_timeout">350</integer>
     <!-- Showing more keys keyboard, just above the touched point if true, aligned to the key if
          false -->
     <bool name="config_show_more_keys_keyboard_at_touched_point">false</bool>
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index 928c5f5d00..9d3d716071 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -89,7 +89,6 @@
         <item name="longPressKeyTimeout">@integer/config_long_press_key_timeout</item>
         <item name="longPressShiftKeyTimeout">@integer/config_long_press_shift_key_timeout</item>
         <item name="ignoreAltCodeKeyTimeout">@integer/config_ignore_alt_code_key_timeout</item>
-        <item name="disableGestureWhileFastTypingTimeout">@integer/config_disable_gesture_while_fast_typing_timeout</item>
         <item name="showMoreKeysKeyboardAtTouchedPoint">@bool/config_show_more_keys_keyboard_at_touched_point</item>
         <item name="languageOnSpacebarFinalAlpha">@integer/config_language_on_spacebar_final_alpha</item>
         <item name="languageOnSpacebarFadeoutAnimator">@anim/language_on_spacebar_fadeout</item>
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index b4c9c7d6f3..b41631e831 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -142,14 +142,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
         private static final int MSG_REPEAT_KEY = 1;
         private static final int MSG_LONGPRESS_KEY = 2;
         private static final int MSG_DOUBLE_TAP = 3;
-        private static final int MSG_DISABLE_GESTURE_EXPIRED = 4;
 
         private final int mKeyRepeatStartTimeout;
         private final int mKeyRepeatInterval;
         private final int mLongPressKeyTimeout;
         private final int mLongPressShiftKeyTimeout;
         private final int mIgnoreAltCodeKeyTimeout;
-        private final int mDisableGestureWhileFastTypingTimeout;
 
         public KeyTimerHandler(final MainKeyboardView outerInstance,
                 final TypedArray mainKeyboardViewAttr) {
@@ -165,8 +163,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
                     R.styleable.MainKeyboardView_longPressShiftKeyTimeout, 0);
             mIgnoreAltCodeKeyTimeout = mainKeyboardViewAttr.getInt(
                     R.styleable.MainKeyboardView_ignoreAltCodeKeyTimeout, 0);
-            mDisableGestureWhileFastTypingTimeout = mainKeyboardViewAttr.getInt(
-                    R.styleable.MainKeyboardView_disableGestureWhileFastTypingTimeout, 0);
         }
 
         @Override
@@ -191,9 +187,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
                     KeyboardSwitcher.getInstance().onLongPressTimeout(msg.arg1);
                 }
                 break;
-            case MSG_DISABLE_GESTURE_EXPIRED:
-                PointerTracker.clearGestureOffWhileFastTyping();
-                break;
             }
         }
 
@@ -318,15 +311,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
             return hasMessages(MSG_TYPING_STATE_EXPIRED);
         }
 
-        // TODO: Remove "gesture off while fast typing" related dead code.
-        @Override
-        public void startGestureOffWhileFastTypingTimer() {
-//            removeMessages(MSG_DISABLE_GESTURE_EXPIRED);
-//            PointerTracker.setGestureOffWhileFastTyping();
-//            sendMessageDelayed(obtainMessage(MSG_DISABLE_GESTURE_EXPIRED),
-//                    mDisableGestureWhileFastTypingTimeout);
-        }
-
         @Override
         public void startDoubleTapTimer() {
             sendMessageDelayed(obtainMessage(MSG_DOUBLE_TAP),
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index 9dae40a93f..5248b8abb6 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -46,7 +46,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
     private static boolean sMainDictionaryAvailable = false;
     private static boolean sGestureHandlingEnabledByInputField = false;
     private static boolean sGestureHandlingEnabledByUser = false;
-    private static boolean sGestureOffWhileFastTyping = false;
 
     public interface KeyEventHandler {
         /**
@@ -85,7 +84,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
     public interface TimerProxy {
         public void startTypingStateTimer(Key typedKey);
         public boolean isTypingState();
-        public void startGestureOffWhileFastTypingTimer();
         public void startKeyRepeatTimer(PointerTracker tracker);
         public void startLongPressTimer(PointerTracker tracker);
         public void startLongPressTimer(int code);
@@ -101,8 +99,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
             @Override
             public boolean isTypingState() { return false; }
             @Override
-            public void startGestureOffWhileFastTypingTimer() {}
-            @Override
             public void startKeyRepeatTimer(PointerTracker tracker) {}
             @Override
             public void startLongPressTimer(PointerTracker tracker) {}
@@ -230,7 +226,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
 
     private static void updateGestureHandlingMode() {
         sShouldHandleGesture = sMainDictionaryAvailable
-                && !sGestureOffWhileFastTyping
                 && sGestureHandlingEnabledByInputField
                 && sGestureHandlingEnabledByUser
                 && !AccessibilityUtils.getInstance().isTouchExplorationEnabled();
@@ -247,16 +242,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
         updateGestureHandlingMode();
     }
 
-    public static void setGestureOffWhileFastTyping() {
-        sGestureOffWhileFastTyping = true;
-        updateGestureHandlingMode();
-    }
-
-    public static void clearGestureOffWhileFastTyping() {
-        sGestureOffWhileFastTyping = false;
-        updateGestureHandlingMode();
-    }
-
     public static PointerTracker getPointerTracker(final int id, final KeyEventHandler handler) {
         final ArrayList<PointerTracker> trackers = sTrackers;
 
@@ -362,10 +347,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
         if (key.isEnabled() || altersCode) {
             if (code == Keyboard.CODE_OUTPUT_TEXT) {
                 mListener.onTextInput(key.getOutputText());
-                mTimerProxy.startGestureOffWhileFastTypingTimer();
             } else if (code != Keyboard.CODE_UNSPECIFIED) {
                 mListener.onCodeInput(code, x, y);
-                mTimerProxy.startGestureOffWhileFastTypingTimer();
             }
         }
     }
-- 
GitLab