Disable touch position correction of MoreKeysKeyboard

Change-Id: Ieec33894a348602fd71d6fe473142b43eb2551b6
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index dbb56ab..4766a22 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -124,6 +124,7 @@
         <item name="keyboardTopPadding">0dp</item>
         <item name="keyboardBottomPadding">0dp</item>
         <item name="horizontalGap">0dp</item>
+        <item name="touchPositionCorrectionData">@null</item>
     </style>
     <style
         name="MoreKeysKeyboardView"
@@ -231,6 +232,7 @@
         <item name="keyboardTopPadding">0dp</item>
         <item name="keyboardBottomPadding">0dp</item>
         <item name="horizontalGap">0dp</item>
+        <item name="touchPositionCorrectionData">@null</item>
     </style>
     <style
         name="MoreKeysKeyboardView.Stone"
@@ -300,6 +302,7 @@
         <item name="keyboardTopPadding">0dp</item>
         <item name="keyboardBottomPadding">0dp</item>
         <item name="horizontalGap">0dp</item>
+        <item name="touchPositionCorrectionData">@null</item>
     </style>
     <style
         name="MoreKeysKeyboardView.Gingerbread"
@@ -355,6 +358,7 @@
         <item name="keyboardTopPadding">0dp</item>
         <item name="keyboardBottomPadding">0dp</item>
         <item name="horizontalGap">0dp</item>
+        <item name="touchPositionCorrectionData">@null</item>
     </style>
     <style
         name="MoreKeysKeyboardView.IceCreamSandwich"
diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
index 06a9e92..94fc805 100644
--- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
+++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
@@ -18,6 +18,7 @@
 
 import android.graphics.Rect;
 import android.text.TextUtils;
+import android.util.Log;
 
 import com.android.inputmethod.keyboard.internal.TouchPositionCorrection;
 import com.android.inputmethod.latin.Constants;
@@ -26,11 +27,14 @@
 import java.util.Arrays;
 
 public final class ProximityInfo {
+    private static final String TAG = ProximityInfo.class.getSimpleName();
+    private static final boolean DEBUG = false;
+
     /** MAX_PROXIMITY_CHARS_SIZE must be the same as MAX_PROXIMITY_CHARS_SIZE_INTERNAL
      * in defines.h */
     public static final int MAX_PROXIMITY_CHARS_SIZE = 16;
     /** Number of key widths from current touch point to search for nearest keys. */
-    private static float SEARCH_DISTANCE = 1.2f;
+    private static final float SEARCH_DISTANCE = 1.2f;
     private static final Key[] EMPTY_KEY_ARRAY = new Key[0];
     private static final float DEFAULT_TOUCH_POSITION_CORRECTION_RADIUS = 0.15f;
 
@@ -140,9 +144,13 @@
         }
 
         if (touchPositionCorrection != null && touchPositionCorrection.isValid()) {
+            if (DEBUG) {
+                Log.d(TAG, "touchPositionCorrection: ON");
+            }
             sweetSpotCenterXs = new float[keyCount];
             sweetSpotCenterYs = new float[keyCount];
             sweetSpotRadii = new float[keyCount];
+            final int rows = touchPositionCorrection.getRows();
             final float defaultRadius = DEFAULT_TOUCH_POSITION_CORRECTION_RADIUS
                     * (float)Math.hypot(mMostCommonKeyWidth, mMostCommonKeyHeight);
             for (int i = 0; i < keyCount; i++) {
@@ -152,7 +160,7 @@
                 sweetSpotCenterYs[i] = hitBox.exactCenterY();
                 sweetSpotRadii[i] = defaultRadius;
                 final int row = hitBox.top / mMostCommonKeyHeight;
-                if (row < touchPositionCorrection.getRows()) {
+                if (row < rows) {
                     final int hitBoxWidth = hitBox.width();
                     final int hitBoxHeight = hitBox.height();
                     final float hitBoxDiagonal = (float)Math.hypot(hitBoxWidth, hitBoxHeight);
@@ -160,9 +168,18 @@
                     sweetSpotCenterYs[i] += touchPositionCorrection.getY(row) * hitBoxHeight;
                     sweetSpotRadii[i] = touchPositionCorrection.getRadius(row) * hitBoxDiagonal;
                 }
+                if (DEBUG) {
+                    Log.d(TAG, String.format(
+                            "  [%2d] row=%d x/y/r=%7.2f/%7.2f/%5.2f %s code=%s", i, row,
+                            sweetSpotCenterXs[i], sweetSpotCenterYs[i], sweetSpotRadii[i],
+                            row < rows ? "correct" : "default", Keyboard.printableCode(key.mCode)));
+                }
             }
         } else {
             sweetSpotCenterXs = sweetSpotCenterYs = sweetSpotRadii = null;
+            if (DEBUG) {
+                Log.d(TAG, "touchPositionCorrection: OFF");
+            }
         }
 
         return setProximityInfoNative(mLocaleStr, MAX_PROXIMITY_CHARS_SIZE,