Merge "Update suggestions when user presses the backspace even when there is not two or more suggestions"
diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml
index 2baae54..b052532 100644
--- a/java/AndroidManifest.xml
+++ b/java/AndroidManifest.xml
@@ -6,7 +6,6 @@
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     <uses-permission android:name="android.permission.READ_USER_DICTIONARY" />
     <uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" />
-    <uses-permission android:name="android.permission.RECORD_AUDIO" />
     <uses-permission android:name="android.permission.READ_CONTACTS" />
 
     <application android:label="@string/english_ime_name"
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 2a76321..34ce527 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -34,7 +34,9 @@
         <attr name="moreSuggestionsViewStyle" format="reference" />
         <attr name="suggestionBackgroundStyle" format="reference" />
         <attr name="suggestionPreviewBackgroundStyle" format="reference" />
-        </declare-styleable>
+        <!-- Touch position correction -->
+        <attr name="touchPositionCorrectionData" format="reference" />
+    </declare-styleable>
 
     <declare-styleable name="KeyboardView">
         <!-- Image for the key. This image needs to be a StateListDrawable, with the following
diff --git a/java/res/values/themes-basic-highcontrast.xml b/java/res/values/themes-basic-highcontrast.xml
index 9127235..bc3c847 100644
--- a/java/res/values/themes-basic-highcontrast.xml
+++ b/java/res/values/themes-basic-highcontrast.xml
@@ -28,5 +28,6 @@
         <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
         <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
+        <item name="touchPositionCorrectionData">@array/touch_position_correction_data_empty</item>
     </style>
 </resources>
diff --git a/java/res/values/themes-basic.xml b/java/res/values/themes-basic.xml
index 6c0e16e..29cb9cc 100644
--- a/java/res/values/themes-basic.xml
+++ b/java/res/values/themes-basic.xml
@@ -28,5 +28,6 @@
         <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
         <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
+        <item name="touchPositionCorrectionData">@array/touch_position_correction_data_empty</item>
     </style>
 </resources>
diff --git a/java/res/values/themes-gingerbread.xml b/java/res/values/themes-gingerbread.xml
index 43bff50..c4a0f80 100644
--- a/java/res/values/themes-gingerbread.xml
+++ b/java/res/values/themes-gingerbread.xml
@@ -28,5 +28,6 @@
         <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
         <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
+        <item name="touchPositionCorrectionData">@array/touch_position_correction_data_gingerbread</item>
     </style>
 </resources>
diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml
index 1235d4e..dd2b6a3 100644
--- a/java/res/values/themes-ics.xml
+++ b/java/res/values/themes-ics.xml
@@ -28,5 +28,6 @@
         <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle.IceCreamSandwich</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle.IceCreamSandwich</item>
         <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle.IceCreamSandwich</item>
+        <item name="touchPositionCorrectionData">@array/touch_position_correction_data_ice_cream_sandwich</item>
     </style>
 </resources>
diff --git a/java/res/values/themes-stone-bold.xml b/java/res/values/themes-stone-bold.xml
index 6e25f41..6e864be 100644
--- a/java/res/values/themes-stone-bold.xml
+++ b/java/res/values/themes-stone-bold.xml
@@ -28,5 +28,6 @@
         <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
         <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
+        <item name="touchPositionCorrectionData">@array/touch_position_correction_data_empty</item>
     </style>
 </resources>
diff --git a/java/res/values/themes-stone.xml b/java/res/values/themes-stone.xml
index 3cbda81..64c5570 100644
--- a/java/res/values/themes-stone.xml
+++ b/java/res/values/themes-stone.xml
@@ -28,5 +28,6 @@
         <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
         <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
+        <item name="touchPositionCorrectionData">@array/touch_position_correction_data_empty</item>
     </style>
 </resources>
diff --git a/java/res/values/touch-position-correction.xml b/java/res/values/touch-position-correction.xml
new file mode 100644
index 0000000..0a0e4e5
--- /dev/null
+++ b/java/res/values/touch-position-correction.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!--
+        An entry of the touch_position_correction word should be:
+        1. (float) (touch_center_x - key_center_x) / key_width
+        2. (float) (touch_center_y - key_center_y) / key_height
+        3. (float) sweet_spot_radius / (key_width^2 + key_height^2)
+     -->
+
+    <string-array
+        name="touch_position_correction_data_empty"
+        translatable="false"
+    >
+        <!-- empty -->
+    </string-array>
+
+    <string-array
+        name="touch_position_correction_data_gingerbread"
+        translatable="false"
+    >
+        <!-- First row -->
+        <item>0.0091285</item>
+        <item>0.1193203</item>
+        <item>0.1622607</item>
+
+        <!-- Second row -->
+        <item>-0.0233128</item>
+        <item>0.1379798</item>
+        <item>0.1585229</item>
+
+        <!-- Third row -->
+        <item>-0.0080185</item>
+        <item>0.1911477</item>
+        <item>0.1570948</item>
+    </string-array>
+
+    <string-array
+        name="touch_position_correction_data_ice_cream_sandwich"
+        translatable="false"
+    >
+        <!-- First row -->
+        <item>0.0038756</item>
+        <item>-0.0005677</item>
+        <item>0.1577026</item>
+
+        <!-- Second row -->
+        <item>-0.0236678</item>
+        <item>0.0381731</item>
+        <item>0.1529972</item>
+
+        <!-- Third row -->
+        <item>-0.0086827</item>
+        <item>0.0880847</item>
+        <item>0.1522819</item>
+    </string-array>
+</resources>
\ No newline at end of file
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 045f0d7..f77155e 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -138,7 +138,8 @@
 
         mProximityInfo = new ProximityInfo(
                 params.GRID_WIDTH, params.GRID_HEIGHT, mOccupiedWidth, mOccupiedHeight,
-                mMostCommonKeyWidth, mKeys);
+                mMostCommonKeyWidth, mKeys, params.mTouchPositionCorrectionXs,
+                params.mTouchPositionCorrectionYs, params.mTouchPositionCorrectionRadii);
     }
 
     public ProximityInfo getProximityInfo() {
diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
index 71b46d6..210ab48 100644
--- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
+++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
@@ -40,8 +40,13 @@
     private final int mKeyboardHeight;
     private final int[][] mGridNeighbors;
 
-    ProximityInfo(
-            int gridWidth, int gridHeight, int minWidth, int height, int keyWidth, List<Key> keys) {
+    private final float[] mTouchPositionCorrectionXs;
+    private final float[] mTouchPositionCorrectionYs;
+    private final float[] mTouchPositionCorrectionRadii;
+
+    ProximityInfo(int gridWidth, int gridHeight, int minWidth, int height, int keyWidth,
+            List<Key> keys, float[] touchPositionCorrectionXs, float[] touchPositionCorrectionYs,
+            float[] touchPositionCorrectionRadii) {
         mGridWidth = gridWidth;
         mGridHeight = gridHeight;
         mGridSize = mGridWidth * mGridHeight;
@@ -49,6 +54,9 @@
         mCellHeight = (height + mGridHeight - 1) / mGridHeight;
         mKeyboardMinWidth = minWidth;
         mKeyboardHeight = height;
+        mTouchPositionCorrectionXs = touchPositionCorrectionXs;
+        mTouchPositionCorrectionYs = touchPositionCorrectionYs;
+        mTouchPositionCorrectionRadii = touchPositionCorrectionRadii;
         mGridNeighbors = new int[mGridSize][];
         if (minWidth == 0 || height == 0) {
             // No proximity required. Keyboard might be mini keyboard.
@@ -58,7 +66,7 @@
     }
 
     public static ProximityInfo createDummyProximityInfo() {
-        return new ProximityInfo(1, 1, 1, 1, 1, Collections.<Key>emptyList());
+        return new ProximityInfo(1, 1, 1, 1, 1, Collections.<Key>emptyList(), null, null, null);
     }
 
     public static ProximityInfo createSpellCheckerProximityInfo() {
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
index 187a1ad..46836da 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
@@ -30,6 +30,7 @@
 import com.android.inputmethod.keyboard.Key;
 import com.android.inputmethod.keyboard.Keyboard;
 import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.latin.LatinImeLogger;
 import com.android.inputmethod.latin.R;
 
 import org.xmlpull.v1.XmlPullParser;
@@ -126,6 +127,8 @@
     private static final int DEFAULT_KEYBOARD_COLUMNS = 10;
     private static final int DEFAULT_KEYBOARD_ROWS = 4;
 
+    private static final int TOUCH_POSITION_CORRECTION_RECORD_SIZE = 3;
+
     protected final KP mParams;
     protected final Context mContext;
     protected final Resources mResources;
@@ -248,10 +251,62 @@
         mParams.mThemeId = a.getInt(R.styleable.KeyboardTheme_themeId, 0);
         a.recycle();
 
+        if (!setTouchPositionCorrectionData(context)) {
+            // In the regression test, setTouchPositionCorrectionData() fails
+            mParams.mTouchPositionCorrectionXs = null;
+            mParams.mTouchPositionCorrectionYs = null;
+            mParams.mTouchPositionCorrectionRadii = null;
+        }
+
         mParams.GRID_WIDTH = res.getInteger(R.integer.config_keyboard_grid_width);
         mParams.GRID_HEIGHT = res.getInteger(R.integer.config_keyboard_grid_height);
     }
 
+    private boolean setTouchPositionCorrectionData(Context context) {
+        final TypedArray a = context.obtainStyledAttributes(R.styleable.KeyboardTheme);
+        final int resourceId = a.getResourceId(
+                R.styleable.KeyboardTheme_touchPositionCorrectionData, 0);
+        if (resourceId == 0) {
+            // In the regression test, we cannot use theme resources
+            // TODO: Fix this
+            return false;
+        }
+        final String[] data = context.getResources().getStringArray(resourceId);
+        a.recycle();
+        final int dataLength = data.length;
+        if (dataLength % TOUCH_POSITION_CORRECTION_RECORD_SIZE != 0) {
+            if (LatinImeLogger.sDBG) {
+                throw new RuntimeException("the size of touch position correction data is invalid");
+            }
+            return false;
+        }
+        final int length = dataLength / TOUCH_POSITION_CORRECTION_RECORD_SIZE;
+        mParams.mTouchPositionCorrectionXs = new float[length];
+        mParams.mTouchPositionCorrectionYs = new float[length];
+        mParams.mTouchPositionCorrectionRadii = new float[length];
+        try {
+            for (int i = 0; i < dataLength; ++i) {
+                final int type = i % TOUCH_POSITION_CORRECTION_RECORD_SIZE;
+                final int index = i / TOUCH_POSITION_CORRECTION_RECORD_SIZE;
+                final float value = Float.parseFloat(data[i]);
+                if (type == 0) {
+                    mParams.mTouchPositionCorrectionXs[index] = value;
+                } else if (type == 1) {
+                    mParams.mTouchPositionCorrectionYs[index] = value;
+                } else {
+                    mParams.mTouchPositionCorrectionRadii[index] = value;
+                }
+            }
+        } catch (NumberFormatException e) {
+            if (LatinImeLogger.sDBG) {
+                throw new RuntimeException(
+                        "the number format for touch position correction data is invalid");
+            }
+            return false;
+        }
+        return true;
+    }
+
     public KeyboardBuilder<KP> load(KeyboardId id) {
         mParams.mId = id;
         try {
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java
index 97f58fa..d1aea72 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java
@@ -68,6 +68,10 @@
     public int mMostCommonKeyHeight = 0;
     public int mMostCommonKeyWidth = 0;
 
+    public float[] mTouchPositionCorrectionXs;
+    public float[] mTouchPositionCorrectionYs;
+    public float[] mTouchPositionCorrectionRadii;
+
     protected void clearKeys() {
         mKeys.clear();
         mShiftKeys.clear();
diff --git a/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java b/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java
index 5a2eb16..51f6c04 100644
--- a/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java
@@ -163,8 +163,6 @@
                 - (container.getMeasuredHeight() - container.getPaddingBottom())
                 + parentView.getPaddingTop() + mCoordinates[1];
 
-        window.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
-        window.setOutsideTouchable(true);
         window.setContentView(container);
         window.setWidth(container.getMeasuredWidth());
         window.setHeight(container.getMeasuredHeight());
@@ -221,22 +219,6 @@
     };
 
     @Override
-    public boolean dispatchTouchEvent(MotionEvent me) {
-        final int index = me.getActionIndex();
-        final int id = me.getPointerId(index);
-        final PointerTracker tracker = PointerTracker.getPointerTracker(id, this);
-        final int x = (int)me.getX(index);
-        final int y = (int)me.getY(index);
-        final boolean inside = (x >= 0 && x < getWidth() && y >= 0 && y < getHeight());
-        if (inside || tracker.isInSlidingKeyInput()) {
-            return super.dispatchTouchEvent(me);
-        } else {
-            dismissMoreKeysPanel();
-            return true;
-        }
-    }
-
-    @Override
     public boolean onTouchEvent(MotionEvent me) {
         final int action = me.getAction();
         final long eventTime = me.getEventTime();
diff --git a/java/src/com/android/inputmethod/latin/SuggestionsView.java b/java/src/com/android/inputmethod/latin/SuggestionsView.java
index 9d0e42a..fe54f4a 100644
--- a/java/src/com/android/inputmethod/latin/SuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/SuggestionsView.java
@@ -27,6 +27,7 @@
 import android.graphics.Rect;
 import android.graphics.Typeface;
 import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Message;
 import android.os.SystemClock;
@@ -506,10 +507,22 @@
         mMoreSuggestionsView = (MoreSuggestionsView)mMoreSuggestionsContainer
                 .findViewById(R.id.more_suggestions_view);
         mMoreSuggestionsBuilder = new MoreSuggestions.Builder(mMoreSuggestionsView);
-        mMoreSuggestionsWindow = new PopupWindow(context);
-        mMoreSuggestionsWindow.setWindowLayoutMode(
+
+        final PopupWindow moreWindow = new PopupWindow(context);
+        moreWindow.setWindowLayoutMode(
                 ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
-        mMoreSuggestionsWindow.setBackgroundDrawable(null);
+        moreWindow.setBackgroundDrawable(new ColorDrawable(android.R.color.transparent));
+        moreWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
+        moreWindow.setFocusable(true);
+        moreWindow.setOutsideTouchable(true);
+        moreWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
+            @Override
+            public void onDismiss() {
+                mKeyboardView.dimEntireKeyboard(false);
+            }
+        });
+        mMoreSuggestionsWindow = moreWindow;
+
         final Resources res = context.getResources();
         mMoreSuggestionsModalTolerance = res.getDimensionPixelOffset(
                 R.dimen.more_suggestions_modal_tolerance);
@@ -517,21 +530,6 @@
                 context, mMoreSuggestionsSlidingListener);
     }
 
-    private final View.OnTouchListener mMoreSuggestionsCanceller = new View.OnTouchListener() {
-        @Override
-        public boolean onTouch(View view, MotionEvent me) {
-            if (!mMoreSuggestionsWindow.isShowing()) return false;
-
-            switch (me.getAction()) {
-            case MotionEvent.ACTION_UP:
-            case MotionEvent.ACTION_POINTER_UP:
-                return mMoreSuggestionsView.dismissMoreKeysPanel();
-            default:
-                return true;
-            }
-        }
-    };
-
     /**
      * A connection back to the input method.
      * @param listener
@@ -726,8 +724,6 @@
     private boolean dismissMoreSuggestions() {
         if (mMoreSuggestionsWindow.isShowing()) {
             mMoreSuggestionsWindow.dismiss();
-            mKeyboardView.dimEntireKeyboard(false);
-            mKeyboardView.setOnTouchListener(null);
             return true;
         }
         return false;
@@ -767,7 +763,6 @@
             mOriginX = mLastX;
             mOriginY = mLastY;
             mKeyboardView.dimEntireKeyboard(true);
-            mKeyboardView.setOnTouchListener(mMoreSuggestionsCanceller);
             for (int i = 0; i < params.mSuggestionsCountInStrip; i++) {
                 mWords.get(i).setPressed(false);
             }
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index 2546df0..37145b2 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -95,6 +95,8 @@
         private final int DEFAULT_SUGGESTION_LENGTH = 16;
         private final ArrayList<CharSequence> mSuggestions;
         private final int[] mScores;
+        private final String mOriginalText;
+        private final double mThreshold;
         private final int mMaxLength;
         private int mLength = 0;
 
@@ -103,7 +105,10 @@
         private String mBestSuggestion = null;
         private int mBestScore = Integer.MIN_VALUE; // As small as possible
 
-        SuggestionsGatherer(final int maxLength) {
+        SuggestionsGatherer(final String originalText, final double threshold,
+                final int maxLength) {
+            mOriginalText = originalText;
+            mThreshold = threshold;
             mMaxLength = maxLength;
             mSuggestions = new ArrayList<CharSequence>(maxLength + 1);
             mScores = new int[mMaxLength];
@@ -146,8 +151,7 @@
             return true;
         }
 
-        public Result getResults(final CharSequence originalText, final double threshold,
-                final int capitalizeType, final Locale locale) {
+        public Result getResults(final int capitalizeType, final Locale locale) {
             final String[] gatheredSuggestions;
             final boolean hasLikelySuggestions;
             if (0 == mLength) {
@@ -160,8 +164,8 @@
                 } else {
                     gatheredSuggestions = EMPTY_STRING_ARRAY;
                     final double normalizedScore =
-                            Utils.calcNormalizedScore(originalText, mBestSuggestion, mBestScore);
-                    hasLikelySuggestions = (normalizedScore > threshold);
+                            Utils.calcNormalizedScore(mOriginalText, mBestSuggestion, mBestScore);
+                    hasLikelySuggestions = (normalizedScore > mThreshold);
                 }
             } else {
                 if (DBG) {
@@ -194,11 +198,11 @@
                 final int bestScore = mScores[mLength - 1];
                 final CharSequence bestSuggestion = mSuggestions.get(0);
                 final double normalizedScore =
-                        Utils.calcNormalizedScore(originalText, bestSuggestion, bestScore);
-                hasLikelySuggestions = (normalizedScore > threshold);
+                        Utils.calcNormalizedScore(mOriginalText, bestSuggestion, bestScore);
+                hasLikelySuggestions = (normalizedScore > mThreshold);
                 if (DBG) {
                     Log.i(TAG, "Best suggestion : " + bestSuggestion + ", score " + bestScore);
-                    Log.i(TAG, "Normalized score = " + normalizedScore + " (threshold " + threshold
+                    Log.i(TAG, "Normalized score = " + normalizedScore + " (threshold " + mThreshold
                             + ") => hasLikelySuggestions = " + hasLikelySuggestions);
                 }
             }
@@ -351,7 +355,7 @@
 
                 // TODO: Don't gather suggestions if the limit is <= 0 unless necessary
                 final SuggestionsGatherer suggestionsGatherer =
-                        new SuggestionsGatherer(suggestionsLimit);
+                        new SuggestionsGatherer(text, mService.mTypoThreshold, suggestionsLimit);
                 final WordComposer composer = new WordComposer();
                 final int length = text.length();
                 for (int i = 0; i < length; ++i) {
@@ -392,8 +396,8 @@
                     }
                 }
 
-                final SuggestionsGatherer.Result result = suggestionsGatherer.getResults(text,
-                        mService.mTypoThreshold, capitalizeType, mLocale);
+                final SuggestionsGatherer.Result result = suggestionsGatherer.getResults(
+                        capitalizeType, mLocale);
 
                 if (DBG) {
                     Log.i(TAG, "Spell checking results for " + text + " with suggestion limit "