From 352286a43b0f951a5082ca741c2bd7f501f48c81 Mon Sep 17 00:00:00 2001
From: Jean Chalard <jchalard@google.com>
Date: Fri, 27 Dec 2013 16:38:13 +0900
Subject: [PATCH] [IL64] Pull up X,Y processing, step 3

Bug: 8636060
Change-Id: Ic051e5d5514d270101b0571a2d30e2caa8f85bc1
---
 .../android/inputmethod/latin/LatinIME.java   | 20 ++++++++++++++--
 .../latin/inputlogic/InputLogic.java          | 24 ++++---------------
 .../inputmethod/research/ResearchLogger.java  |  2 +-
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index d3e6a1bc2b..0f40e13652 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1246,8 +1246,24 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
 
     // Implementation of {@link KeyboardActionListener}.
     @Override
-    public void onCodeInput(final int primaryCode, final int x, final int y) {
-        mInputLogic.onCodeInput(primaryCode, x, y, mHandler, mKeyboardSwitcher, mSubtypeSwitcher);
+    public void onCodeInput(final int codePoint, final int x, final int y) {
+        final int keyX, keyY;
+        final Keyboard keyboard = mKeyboardSwitcher.getKeyboard();
+        final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
+        // x and y include some padding, but everything down the line (especially native
+        // code) needs the coordinates in the keyboard frame.
+        // TODO: We should reconsider which coordinate system should be used to represent
+        // keyboard event. Also we should pull this up -- LatinIME has no business doing
+        // this transformation, it should be done already before calling onCodeInput.
+        if (keyboard != null && keyboard.hasProximityCharsCorrection(codePoint)) {
+            keyX = mainKeyboardView.getKeyX(x);
+            keyY = mainKeyboardView.getKeyY(y);
+        } else {
+            keyX = Constants.NOT_A_COORDINATE;
+            keyY = Constants.NOT_A_COORDINATE;
+        }
+        mInputLogic.onCodeInput(codePoint, keyX, keyY, mHandler, mKeyboardSwitcher,
+                mSubtypeSwitcher);
     }
 
     // Called from PointerTracker through the KeyboardActionListener interface
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index 079e65766d..20be814117 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -30,7 +30,6 @@ import com.android.inputmethod.compat.SuggestionSpanUtils;
 import com.android.inputmethod.event.EventInterpreter;
 import com.android.inputmethod.keyboard.Keyboard;
 import com.android.inputmethod.keyboard.KeyboardSwitcher;
-import com.android.inputmethod.keyboard.MainKeyboardView;
 import com.android.inputmethod.latin.Constants;
 import com.android.inputmethod.latin.Dictionary;
 import com.android.inputmethod.latin.InputPointers;
@@ -225,25 +224,10 @@ public final class InputLogic {
         }
 
         boolean didAutoCorrect = false;
-        final int keyX, keyY;
-        final Keyboard keyboard = keyboardSwitcher.getKeyboard();
-        final MainKeyboardView mainKeyboardView = keyboardSwitcher.getMainKeyboardView();
-        // TODO: We should reconsider which coordinate system should be used to represent
-        // keyboard event.
-        if (keyboard != null && keyboard.hasProximityCharsCorrection(code)) {
-            // x and y include some padding, but everything down the line (especially native
-            // code) needs the coordinates in the keyboard frame.
-            // TODO: move this frame change up
-            keyX = mainKeyboardView.getKeyX(x);
-            keyY = mainKeyboardView.getKeyY(y);
-        } else {
-            keyX = Constants.NOT_A_COORDINATE;
-            keyY = Constants.NOT_A_COORDINATE;
-        }
         switch (code) {
         case Constants.CODE_DELETE:
             handleBackspace(settingsValues, spaceState, handler, keyboardSwitcher);
-            LatinImeLogger.logOnDelete(keyX, keyY);
+            LatinImeLogger.logOnDelete(x, y);
             break;
         case Constants.CODE_SHIFT:
             // Note: Calling back to the keyboard on Shift key is handled in
@@ -304,16 +288,16 @@ public final class InputLogic {
                 // No action label, and the action from imeOptions is NONE: this is a regular
                 // enter key that should input a carriage return.
                 didAutoCorrect = handleNonSpecialCharacter(settingsValues, Constants.CODE_ENTER,
-                        keyX, keyY, spaceState, keyboardSwitcher, handler);
+                        x, y, spaceState, keyboardSwitcher, handler);
             }
             break;
         case Constants.CODE_SHIFT_ENTER:
             didAutoCorrect = handleNonSpecialCharacter(settingsValues, Constants.CODE_ENTER,
-                    keyX, keyY, spaceState, keyboardSwitcher, handler);
+                    x, y, spaceState, keyboardSwitcher, handler);
             break;
         default:
             didAutoCorrect = handleNonSpecialCharacter(settingsValues,
-                    code, keyX, keyY, spaceState, keyboardSwitcher, handler);
+                    code, x, y, spaceState, keyboardSwitcher, handler);
             break;
         }
         keyboardSwitcher.onCodeInput(code);
diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java
index 11fb3a1564..2a8148d023 100644
--- a/java/src/com/android/inputmethod/research/ResearchLogger.java
+++ b/java/src/com/android/inputmethod/research/ResearchLogger.java
@@ -109,7 +109,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
     // feedback mechanism to generate multiple tests.
     private static final boolean FEEDBACK_DIALOG_SHOULD_PRESERVE_TEXT_FIELD = false;
     /* package */ static boolean sIsLogging = false;
-    private static final int OUTPUT_FORMAT_VERSION = 5;
+    private static final int OUTPUT_FORMAT_VERSION = 6;
     // Whether all words should be recorded, leaving unsampled word between bigrams.  Useful for
     // testing.
     /* package for test */ static final boolean IS_LOGGING_EVERYTHING = false
-- 
GitLab