Merge "Import translations. DO NOT MERGE"
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 6c56b8a..3590c48 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -700,12 +700,12 @@
     }
 
     @Override
-    public void onCancelMoreKeysPanel(final MoreKeysPanel panel) {
+    public void onCancelMoreKeysPanel() {
         PointerTracker.dismissAllMoreKeysPanels();
     }
 
     @Override
-    public void onDismissMoreKeysPanel(final MoreKeysPanel panel) {
+    public void onDismissMoreKeysPanel() {
         dimEntireKeyboard(false /* dimmed */);
         if (isShowingMoreKeysPanel()) {
             mMoreKeysPanel.removeFromParent();
diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java
index 1891dfc..fc33197 100644
--- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java
@@ -122,7 +122,7 @@
         onMoveKeyInternal(x, y, pointerId);
         if (hasOldKey && mCurrentKey == null) {
             // If the pointer has moved too far away from any target then cancel the panel.
-            mController.onCancelMoreKeysPanel(this);
+            mController.onCancelMoreKeysPanel();
         }
     }
 
@@ -184,7 +184,7 @@
         if (!isShowingInParent()) {
             return;
         }
-        mController.onDismissMoreKeysPanel(this);
+        mController.onDismissMoreKeysPanel();
     }
 
     @Override
diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysPanel.java b/java/src/com/android/inputmethod/keyboard/MoreKeysPanel.java
index 4a33e65..7bddd09 100644
--- a/java/src/com/android/inputmethod/keyboard/MoreKeysPanel.java
+++ b/java/src/com/android/inputmethod/keyboard/MoreKeysPanel.java
@@ -29,24 +29,22 @@
 
         /**
          * Remove the current {@link MoreKeysPanel} from the target view.
-         * @param panel the panel to be dismissed.
          */
-        public void onDismissMoreKeysPanel(final MoreKeysPanel panel);
+        public void onDismissMoreKeysPanel();
 
         /**
          * Instructs the parent to cancel the panel (e.g., when entering a different input mode).
-         * @param panel the panel to be canceled.
          */
-        public void onCancelMoreKeysPanel(final MoreKeysPanel panel);
+        public void onCancelMoreKeysPanel();
     }
 
     public static final Controller EMPTY_CONTROLLER = new Controller() {
         @Override
         public void onShowMoreKeysPanel(final MoreKeysPanel panel) {}
         @Override
-        public void onDismissMoreKeysPanel(final MoreKeysPanel panel) {}
+        public void onDismissMoreKeysPanel() {}
         @Override
-        public void onCancelMoreKeysPanel(final MoreKeysPanel panel) {}
+        public void onCancelMoreKeysPanel() {}
     };
 
     /**
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 4c2454c..44353ba 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -78,7 +78,6 @@
 import com.android.inputmethod.latin.suggestions.SuggestionStripViewAccessor;
 import com.android.inputmethod.latin.utils.ApplicationUtils;
 import com.android.inputmethod.latin.utils.CapsModeUtils;
-import com.android.inputmethod.latin.utils.CompletionInfoUtils;
 import com.android.inputmethod.latin.utils.CoordinateUtils;
 import com.android.inputmethod.latin.utils.ImportantNoticeUtils;
 import com.android.inputmethod.latin.utils.IntentUtils;
@@ -124,9 +123,6 @@
     private View mKeyPreviewBackingView;
     private SuggestionStripView mSuggestionStripView;
 
-    // TODO[IL]: remove this member completely.
-    public CompletionInfo[] mApplicationSpecifiedCompletions;
-
     private RichInputMethodManager mRichImm;
     @UsedForTesting final KeyboardSwitcher mKeyboardSwitcher;
     private final SubtypeSwitcher mSubtypeSwitcher;
@@ -192,8 +188,9 @@
             final KeyboardSwitcher switcher = latinIme.mKeyboardSwitcher;
             switch (msg.what) {
             case MSG_UPDATE_SUGGESTION_STRIP:
+                cancelUpdateSuggestionStrip();
                 latinIme.mInputLogic.performUpdateSuggestionStripSync(
-                        latinIme.mSettings.getCurrent(), this /* handler */);
+                        latinIme.mSettings.getCurrent());
                 break;
             case MSG_UPDATE_SHIFT_STATE:
                 switcher.updateShiftState();
@@ -554,7 +551,7 @@
             // Create Suggest instance with the new dictionary facilitator.
             replaceSuggest(new Suggest(oldSuggest, dictionaryFacilitator));
         } else if (oldSuggest == null) {
-            initSuggestForLocale(oldSuggest, locale);
+            initSuggest();
         }
     }
 
@@ -812,7 +809,6 @@
         // The EditorInfo might have a flag that affects fullscreen mode.
         // Note: This call should be done by InputMethodService?
         updateFullscreenMode();
-        mApplicationSpecifiedCompletions = null;
 
         // The app calling setText() has the effect of clearing the composing
         // span, so we should reset our state unconditionally, even if restarting is true.
@@ -879,7 +875,7 @@
         }
         // This will set the punctuation suggestions if next word suggestion is off;
         // otherwise it will clear the suggestion strip.
-        setNeutralSuggestionStripInternal();
+        setNeutralSuggestionStrip();
 
         mHandler.cancelUpdateSuggestionStrip();
         mHandler.cancelDoubleSpacePeriodTimer();
@@ -954,8 +950,7 @@
         // NOTE: the test harness subclasses LatinIME and overrides isInputViewShown().
         // TODO: find a better way to simulate actual execution.
         if (isInputViewShown() &&
-                mInputLogic.onUpdateSelection(mSettings.getCurrent(), oldSelStart, oldSelEnd,
-                        newSelStart, newSelEnd, composingSpanStart, composingSpanEnd)) {
+                mInputLogic.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd)) {
             mKeyboardSwitcher.updateShiftState();
         }
 
@@ -1034,8 +1029,6 @@
             }
             return;
         }
-        mApplicationSpecifiedCompletions =
-                CompletionInfoUtils.removeNulls(applicationSpecifiedCompletions);
 
         final ArrayList<SuggestedWords.SuggestedWordInfo> applicationSuggestedWords =
                 SuggestedWords.getFromApplicationSpecifiedCompletions(
@@ -1050,18 +1043,6 @@
         }
     }
 
-    private void setSuggestionStripShownInternal(final boolean isSuggestionStripVisible) {
-        // TODO: Modify this if we support suggestions with hard keyboard
-        if (!onEvaluateInputViewShown() || !hasSuggestionStripView()) {
-            return;
-        }
-        if (isSuggestionStripVisible) {
-            mSuggestionStripView.setVisibility(View.VISIBLE);
-        } else {
-            mSuggestionStripView.setVisibility(isFullscreenMode() ? View.GONE : View.INVISIBLE);
-        }
-    }
-
     private int getAdjustedBackingViewHeight() {
         final int currentHeight = mKeyPreviewBackingView.getHeight();
         if (currentHeight > 0) {
@@ -1299,7 +1280,7 @@
 
     @Override
     public void onStartBatchInput() {
-        mInputLogic.onStartBatchInput(mSettings.getCurrent(),  mKeyboardSwitcher, mHandler);
+        mInputLogic.onStartBatchInput(mSettings.getCurrent(), mKeyboardSwitcher, mHandler);
     }
 
     @Override
@@ -1309,7 +1290,7 @@
 
     @Override
     public void onEndBatchInput(final InputPointers batchPointers) {
-        mInputLogic.onEndBatchInput(mSettings.getCurrent(), batchPointers);
+        mInputLogic.onEndBatchInput(batchPointers);
     }
 
     @Override
@@ -1387,13 +1368,23 @@
     public void setSuggestedWords(final SuggestedWords suggestedWords,
             final boolean isSuggestionStripVisible) {
         mInputLogic.setSuggestedWords(suggestedWords);
+        // TODO: Modify this when we support suggestions with hard keyboard
         if (!hasSuggestionStripView()) {
             return;
         }
+        mKeyboardSwitcher.onAutoCorrectionStateChanged(suggestedWords.mWillAutoCorrect);
+        if (!onEvaluateInputViewShown()) {
+            return;
+        }
+        if (!isSuggestionStripVisible) {
+            mSuggestionStripView.setVisibility(isFullscreenMode() ? View.GONE : View.INVISIBLE);
+            return;
+        }
+        mSuggestionStripView.setVisibility(View.VISIBLE);
+
         final SettingsValues currentSettings = mSettings.getCurrent();
         final boolean showSuggestions;
-        if (SuggestedWords.EMPTY == suggestedWords
-                || suggestedWords.isPunctuationSuggestions()
+        if (SuggestedWords.EMPTY == suggestedWords || suggestedWords.isPunctuationSuggestions()
                 || !currentSettings.isSuggestionsRequested()) {
             showSuggestions = !mSuggestionStripView.maybeShowImportantNoticeTitle(
                     currentSettings.mInputAttributes);
@@ -1404,8 +1395,6 @@
             mSuggestionStripView.setSuggestions(suggestedWords,
                     SubtypeLocaleUtils.isRtlLanguage(mSubtypeSwitcher.getCurrentSubtype()));
         }
-        mKeyboardSwitcher.onAutoCorrectionStateChanged(suggestedWords.mWillAutoCorrect);
-        setSuggestionStripShownInternal(isSuggestionStripVisible);
     }
 
     // TODO[IL]: Move this out of LatinIME.
@@ -1449,32 +1438,6 @@
                 sequenceNumber, callback);
     }
 
-    // TODO[IL]: Move this to InputLogic
-    public SuggestedWords maybeRetrieveOlderSuggestions(final String typedWord,
-            final SuggestedWords suggestedWords, final SuggestedWords previousSuggestedWords) {
-        // TODO: consolidate this into getSuggestedWords
-        // We update the suggestion strip only when we have some suggestions to show, i.e. when
-        // the suggestion count is > 1; else, we leave the old suggestions, with the typed word
-        // replaced with the new one. However, when the length of the typed word is 1 or 0 (after
-        // a deletion typically), we do want to remove the old suggestions. Also, if we are showing
-        // the "add to dictionary" hint, we need to revert to suggestions - although it is unclear
-        // how we can come here if it's displayed.
-        if (suggestedWords.size() > 1 || typedWord.length() <= 1
-                || !hasSuggestionStripView() || isShowingAddToDictionaryHint()) {
-            return suggestedWords;
-        } else {
-            final SuggestedWords punctuationList =
-                    mSettings.getCurrent().mSpacingAndPunctuations.mSuggestPuncList;
-            final SuggestedWords oldSuggestedWords = previousSuggestedWords == punctuationList
-                    ? SuggestedWords.EMPTY : previousSuggestedWords;
-            final ArrayList<SuggestedWords.SuggestedWordInfo> typedWordAndPreviousSuggestions =
-                    SuggestedWords.getTypedWordAndPreviousSuggestions(typedWord, oldSuggestedWords);
-            return new SuggestedWords(typedWordAndPreviousSuggestions, null /* rawSuggestions */,
-                    false /* typedWordValid */, false /* hasAutoCorrectionCandidate */,
-                    true /* isObsoleteSuggestions */, false /* isPrediction */);
-        }
-    }
-
     @Override
     public void showSuggestionStrip(final SuggestedWords sourceSuggestedWords) {
         final SuggestedWords suggestedWords =
@@ -1515,15 +1478,10 @@
         mSuggestionStripView.showAddToDictionaryHint(word);
     }
 
-    // TODO[IL]: Define a clean interface for this
     // This will show either an empty suggestion strip (if prediction is enabled) or
     // punctuation suggestions (if it's disabled).
     @Override
     public void setNeutralSuggestionStrip() {
-        setNeutralSuggestionStripInternal();
-    }
-
-    private void setNeutralSuggestionStripInternal() {
         final SettingsValues currentSettings = mSettings.getCurrent();
         final SuggestedWords neutralSuggestions = currentSettings.mBigramPredictionEnabled
                 ? SuggestedWords.EMPTY : currentSettings.mSpacingAndPunctuations.mSuggestPuncList;
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java
index 06bc90c..dc2c9fd 100644
--- a/java/src/com/android/inputmethod/latin/SuggestedWords.java
+++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java
@@ -167,15 +167,10 @@
             final CompletionInfo[] infos) {
         final ArrayList<SuggestedWordInfo> result = CollectionUtils.newArrayList();
         for (final CompletionInfo info : infos) {
-            if (info == null) continue;
-            final CharSequence text = info.getText();
-            if (null == text) continue;
-            final SuggestedWordInfo suggestedWordInfo = new SuggestedWordInfo(text.toString(),
-                    SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_APP_DEFINED,
-                    Dictionary.DICTIONARY_APPLICATION_DEFINED,
-                    SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */,
-                    SuggestedWordInfo.NOT_A_CONFIDENCE /* autoCommitFirstWordConfidence */);
-            result.add(suggestedWordInfo);
+            if (null == info || null == info.getText()) {
+                continue;
+            }
+            result.add(new SuggestedWordInfo(info));
         }
         return result;
     }
@@ -234,6 +229,9 @@
         public static final int KIND_FLAG_EXACT_MATCH = 0x40000000;
 
         public final String mWord;
+        // The completion info from the application. Null for suggestions that don't come from
+        // the application (including keyboard-computed ones, so this is almost always null)
+        public final CompletionInfo mApplicationSpecifiedCompletionInfo;
         public final int mScore;
         public final int mKind; // one of the KIND_* constants above
         public final int mCodePointCount;
@@ -260,6 +258,7 @@
                 final Dictionary sourceDict, final int indexOfTouchPointOfSecondWord,
                 final int autoCommitFirstWordConfidence) {
             mWord = word;
+            mApplicationSpecifiedCompletionInfo = null;
             mScore = score;
             mKind = kind;
             mSourceDict = sourceDict;
@@ -268,6 +267,22 @@
             mAutoCommitFirstWordConfidence = autoCommitFirstWordConfidence;
         }
 
+        /**
+         * Create a new suggested word info from an application-specified completion.
+         * If the passed argument or its contained text is null, this throws a NPE.
+         * @param applicationSpecifiedCompletion The application-specified completion info.
+         */
+        public SuggestedWordInfo(final CompletionInfo applicationSpecifiedCompletion) {
+            mWord = applicationSpecifiedCompletion.getText().toString();
+            mApplicationSpecifiedCompletionInfo = applicationSpecifiedCompletion;
+            mScore = SuggestedWordInfo.MAX_SCORE;
+            mKind = SuggestedWordInfo.KIND_APP_DEFINED;
+            mSourceDict = Dictionary.DICTIONARY_APPLICATION_DEFINED;
+            mCodePointCount = StringUtils.codePointCount(mWord);
+            mIndexOfTouchPointOfSecondWord = SuggestedWordInfo.NOT_AN_INDEX;
+            mAutoCommitFirstWordConfidence = SuggestedWordInfo.NOT_A_CONFIDENCE;
+        }
+
         public boolean isEligibleForAutoCommit() {
             return (KIND_CORRECTION == mKind && NOT_AN_INDEX != mIndexOfTouchPointOfSecondWord);
         }
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index f2f9f1e..0e4374a 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -74,7 +74,7 @@
 
     // TODO : make all these fields private as soon as possible.
     // Current space state of the input method. This can be any of the above constants.
-    public int mSpaceState;
+    private int mSpaceState;
     // Never null
     public SuggestedWords mSuggestedWords = SuggestedWords.EMPTY;
     // TODO: mSuggest should be touched by a single thread.
@@ -85,7 +85,7 @@
     public LastComposedWord mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD;
     public final WordComposer mWordComposer;
     public final RichInputConnection mConnection;
-    public final RecapitalizeStatus mRecapitalizeStatus = new RecapitalizeStatus();
+    private final RecapitalizeStatus mRecapitalizeStatus = new RecapitalizeStatus();
 
     private int mDeleteCount;
     private long mLastKeyTime;
@@ -96,7 +96,7 @@
 
     // TODO: This boolean is persistent state and causes large side effects at unexpected times.
     // Find a way to remove it for readability.
-    public boolean mIsAutoCorrectionIndicatorOn;
+    private boolean mIsAutoCorrectionIndicatorOn;
 
     public InputLogic(final LatinIME latinIME,
             final SuggestionStripViewAccessor suggestionStripViewAccessor) {
@@ -227,17 +227,16 @@
             }
         }
 
-        // TODO: stop relying on mApplicationSpecifiedCompletions. The SuggestionInfo object
-        // should contain a reference to the CompletionInfo instead.
-        if (settingsValues.isApplicationSpecifiedCompletionsOn()
-                && mLatinIME.mApplicationSpecifiedCompletions != null
-                && index >= 0 && index < mLatinIME.mApplicationSpecifiedCompletions.length) {
+        // TODO: We should not need the following branch. We should be able to take the same
+        // code path as for other kinds, use commitChosenWord, and do everything normally. We will
+        // however need to reset the suggestion strip right away, because we know we can't take
+        // the risk of calling commitCompletion twice because we don't know how the app will react.
+        if (SuggestedWordInfo.KIND_APP_DEFINED == suggestionInfo.mKind) {
             mSuggestedWords = SuggestedWords.EMPTY;
             mSuggestionStripViewAccessor.setNeutralSuggestionStrip();
             keyboardSwitcher.updateShiftState();
             resetComposingState(true /* alsoResetLastComposedWord */);
-            final CompletionInfo completionInfo = mLatinIME.mApplicationSpecifiedCompletions[index];
-            mConnection.commitCompletion(completionInfo);
+            mConnection.commitCompletion(suggestionInfo.mApplicationSpecifiedCompletionInfo);
             mConnection.endBatchEdit();
             return;
         }
@@ -290,19 +289,14 @@
      * Consider an update to the cursor position. Evaluate whether this update has happened as
      * part of normal typing or whether it was an explicit cursor move by the user. In any case,
      * do the necessary adjustments.
-     * @param settingsValues the current settings
      * @param oldSelStart old selection start
      * @param oldSelEnd old selection end
      * @param newSelStart new selection start
      * @param newSelEnd new selection end
-     * @param composingSpanStart composing span start
-     * @param composingSpanEnd composing span end
      * @return whether the cursor has moved as a result of user interaction.
      */
-    public boolean onUpdateSelection(final SettingsValues settingsValues,
-            final int oldSelStart, final int oldSelEnd,
-            final int newSelStart, final int newSelEnd,
-            final int composingSpanStart, final int composingSpanEnd) {
+    public boolean onUpdateSelection(final int oldSelStart, final int oldSelEnd,
+            final int newSelStart, final int newSelEnd) {
         if (mConnection.isBelatedExpectedUpdate(oldSelStart, newSelStart, oldSelEnd, newSelEnd)) {
             return false;
         }
@@ -335,8 +329,7 @@
             // we'd have the suggestion strip noticeably janky. To avoid that, we don't clear
             // it here, which means we'll keep outdated suggestions for a split second but the
             // visual result is better.
-            resetEntireInputState(settingsValues, newSelStart, newSelEnd,
-                    false /* clearSuggestionStrip */);
+            resetEntireInputState(newSelStart, newSelEnd, false /* clearSuggestionStrip */);
         } else {
             // resetEntireInputState calls resetCachesUponCursorMove, but forcing the
             // composition to end. But in all cases where we don't reset the entire input
@@ -504,7 +497,7 @@
             if (mWordComposer.isCursorFrontOrMiddleOfComposingWord()) {
                 // If we are in the middle of a recorrection, we need to commit the recorrection
                 // first so that we can insert the batch input at the current cursor position.
-                resetEntireInputState(settingsValues, mConnection.getExpectedSelectionStart(),
+                resetEntireInputState(mConnection.getExpectedSelectionStart(),
                         mConnection.getExpectedSelectionEnd(), true /* clearSuggestionStrip */);
             } else if (wordComposerSize <= 1) {
                 // We auto-correct the previous (typed, not gestured) string iff it's one character
@@ -585,8 +578,7 @@
         mInputLogicHandler.onUpdateBatchInput(batchPointers, mAutoCommitSequenceNumber);
     }
 
-    public void onEndBatchInput(final SettingsValues settingValues,
-            final InputPointers batchPointers) {
+    public void onEndBatchInput(final InputPointers batchPointers) {
         mInputLogicHandler.onEndBatchInput(batchPointers, mAutoCommitSequenceNumber);
         ++mAutoCommitSequenceNumber;
     }
@@ -658,7 +650,7 @@
                 if (mWordComposer.isCursorFrontOrMiddleOfComposingWord()) {
                     // If we are in the middle of a recorrection, we need to commit the recorrection
                     // first so that we can insert the character at the current cursor position.
-                    resetEntireInputState(settingsValues, mConnection.getExpectedSelectionStart(),
+                    resetEntireInputState(mConnection.getExpectedSelectionStart(),
                             mConnection.getExpectedSelectionEnd(), true /* clearSuggestionStrip */);
                 } else {
                     commitTyped(settingsValues, LastComposedWord.NOT_A_SEPARATOR);
@@ -700,7 +692,7 @@
         if (mWordComposer.isCursorFrontOrMiddleOfComposingWord()) {
             // If we are in the middle of a recorrection, we need to commit the recorrection
             // first so that we can insert the character at the current cursor position.
-            resetEntireInputState(settingsValues, mConnection.getExpectedSelectionStart(),
+            resetEntireInputState(mConnection.getExpectedSelectionStart(),
                     mConnection.getExpectedSelectionEnd(), true /* clearSuggestionStrip */);
             isComposingWord = false;
         }
@@ -782,7 +774,7 @@
         if (mWordComposer.isCursorFrontOrMiddleOfComposingWord()) {
             // If we are in the middle of a recorrection, we need to commit the recorrection
             // first so that we can insert the separator at the current cursor position.
-            resetEntireInputState(settingsValues, mConnection.getExpectedSelectionStart(),
+            resetEntireInputState(mConnection.getExpectedSelectionStart(),
                     mConnection.getExpectedSelectionEnd(), true /* clearSuggestionStrip */);
         }
         // isComposingWord() may have changed since we stored wasComposing
@@ -877,7 +869,6 @@
             // TODO: remove these arguments
             final LatinIME.UIHandler handler, final KeyboardSwitcher keyboardSwitcher) {
         mSpaceState = SpaceState.NONE;
-        final int deleteCountAtStart = mDeleteCount;
         mDeleteCount++;
 
         // In many cases, we may have to put the keyboard in auto-shift state again. However
@@ -888,7 +879,7 @@
         if (mWordComposer.isCursorFrontOrMiddleOfComposingWord()) {
             // If we are in the middle of a recorrection, we need to commit the recorrection
             // first so that we can remove the character at the current cursor position.
-            resetEntireInputState(settingsValues, mConnection.getExpectedSelectionStart(),
+            resetEntireInputState(mConnection.getExpectedSelectionStart(),
                     mConnection.getExpectedSelectionEnd(), true /* clearSuggestionStrip */);
             // When we exit this if-clause, mWordComposer.isComposingWord() will return false.
         }
@@ -1205,11 +1196,7 @@
                 timeStampInSeconds);
     }
 
-    public void performUpdateSuggestionStripSync(final SettingsValues settingsValues,
-            // TODO: Remove this argument
-            final LatinIME.UIHandler handler) {
-        handler.cancelUpdateSuggestionStrip();
-
+    public void performUpdateSuggestionStripSync(final SettingsValues settingsValues) {
         // Check if we have a suggestion engine attached.
         if (mSuggest == null || !settingsValues.isSuggestionsRequested()) {
             if (mWordComposer.isComposingWord()) {
@@ -1229,11 +1216,15 @@
                 SuggestedWords.NOT_A_SEQUENCE_NUMBER, new OnGetSuggestedWordsCallback() {
                     @Override
                     public void onGetSuggestedWords(final SuggestedWords suggestedWords) {
-                        final SuggestedWords suggestedWordsWithMaybeOlderSuggestions =
-                                mLatinIME.maybeRetrieveOlderSuggestions(
-                                        mWordComposer.getTypedWord(), suggestedWords,
-                                        mSuggestedWords);
-                        holder.set(suggestedWordsWithMaybeOlderSuggestions);
+                        final String typedWord = mWordComposer.getTypedWord();
+                        // Show new suggestions if we have at least one. Otherwise keep the old
+                        // suggestions with the new typed word. Exception: if the length of the
+                        // typed word is <= 1 (after a deletion typically) we clear old suggestions.
+                        if (suggestedWords.size() > 1 || typedWord.length() <= 1) {
+                            holder.set(suggestedWords);
+                        } else {
+                            holder.set(retrieveOlderSuggestions(typedWord, mSuggestedWords));
+                        }
                     }
                 }
         );
@@ -1623,15 +1614,13 @@
      * This will clear the composing word, reset the last composed word, clear the suggestion
      * strip and tell the input connection about it so that it can refresh its caches.
      *
-     * @param settingsValues the current values of the settings.
      * @param newSelStart the new selection start, in java characters.
      * @param newSelEnd the new selection end, in java characters.
      * @param clearSuggestionStrip whether this method should clear the suggestion strip.
      */
     // TODO: how is this different from startInput ?!
-    // TODO: remove all references to this in LatinIME and make this private
-    public void resetEntireInputState(final SettingsValues settingsValues,
-            final int newSelStart, final int newSelEnd, final boolean clearSuggestionStrip) {
+    private void resetEntireInputState(final int newSelStart, final int newSelEnd,
+            final boolean clearSuggestionStrip) {
         final boolean shouldFinishComposition = mWordComposer.isComposingWord();
         resetComposingState(true /* alsoResetLastComposedWord */);
         if (clearSuggestionStrip) {
@@ -1649,8 +1638,7 @@
      *
      * @param alsoResetLastComposedWord whether to also reset the last composed word.
      */
-    // TODO: remove all references to this in LatinIME and make this private.
-    public void resetComposingState(final boolean alsoResetLastComposedWord) {
+    private void resetComposingState(final boolean alsoResetLastComposedWord) {
         mWordComposer.reset();
         if (alsoResetLastComposedWord) {
             mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD;
@@ -1658,6 +1646,27 @@
     }
 
     /**
+     * Make a {@link com.android.inputmethod.latin.SuggestedWords} object containing a typed word
+     * and obsolete suggestions.
+     * See {@link com.android.inputmethod.latin.SuggestedWords#getTypedWordAndPreviousSuggestions(
+     *      String, com.android.inputmethod.latin.SuggestedWords)}.
+     * @param typedWord The typed word as a string.
+     * @param previousSuggestedWords The previously suggested words.
+     * @return Obsolete suggestions with the newly typed word.
+     */
+    private SuggestedWords retrieveOlderSuggestions(final String typedWord,
+            final SuggestedWords previousSuggestedWords) {
+        final SuggestedWords oldSuggestedWords =
+                previousSuggestedWords.isPunctuationSuggestions() ? SuggestedWords.EMPTY
+                        : previousSuggestedWords;
+        final ArrayList<SuggestedWords.SuggestedWordInfo> typedWordAndPreviousSuggestions =
+                SuggestedWords.getTypedWordAndPreviousSuggestions(typedWord, oldSuggestedWords);
+        return new SuggestedWords(typedWordAndPreviousSuggestions, null /* rawSuggestions */,
+                false /* typedWordValid */, false /* hasAutoCorrectionCandidate */,
+                true /* isObsoleteSuggestions */, false /* isPrediction */);
+    }
+
+    /**
      * Gets a chunk of text with or the auto-correction indicator underline span as appropriate.
      *
      * This method looks at the old state of the auto-correction indicator to put or not put
@@ -1674,9 +1683,8 @@
      * @param text the text on which to maybe apply the span.
      * @return the same text, with the auto-correction underline span if that's appropriate.
      */
-    // TODO: remove all references to this in LatinIME and make this private. Also, shouldn't
-    // this go in some *Utils class instead?
-    public CharSequence getTextWithUnderline(final String text) {
+    // TODO: Shouldn't this go in some *Utils class instead?
+    private CharSequence getTextWithUnderline(final String text) {
         return mIsAutoCorrectionIndicatorOn
                 ? SuggestionSpanUtils.getTextWithAutoCorrectionIndicatorUnderline(mLatinIME, text)
                 : text;
@@ -1741,8 +1749,7 @@
      *
      * @param settingsValues the current values of the settings.
      */
-    // TODO: Make this private.
-    public void promotePhantomSpace(final SettingsValues settingsValues) {
+    private void promotePhantomSpace(final SettingsValues settingsValues) {
         if (settingsValues.shouldInsertSpacesAutomatically()
                 && settingsValues.mSpacingAndPunctuations.mCurrentLanguageHasSpaces
                 && !mConnection.textBeforeCursorLooksLikeURL()) {
@@ -1848,7 +1855,8 @@
             final LatinIME.UIHandler handler) {
         // Complete any pending suggestions query first
         if (handler.hasPendingUpdateSuggestions()) {
-            performUpdateSuggestionStripSync(settingsValues, handler);
+            handler.cancelUpdateSuggestionStrip();
+            performUpdateSuggestionStripSync(settingsValues);
         }
         final String typedAutoCorrection = mWordComposer.getAutoCorrectionOrNull();
         final String typedWord = mWordComposer.getTypedWord();
@@ -1892,8 +1900,7 @@
      * @param commitType the type of the commit, as one of LastComposedWord.COMMIT_TYPE_*
      * @param separatorString the separator that's causing the commit, or NOT_A_SEPARATOR if none.
      */
-    // TODO: Make this private
-    public void commitChosenWord(final SettingsValues settingsValues, final String chosenWord,
+    private void commitChosenWord(final SettingsValues settingsValues, final String chosenWord,
             final int commitType, final String separatorString) {
         final SuggestedWords suggestedWords = mSuggestedWords;
         final CharSequence chosenWordWithSuggestions =
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
index 4ef562d..43cb11b 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
@@ -35,7 +35,6 @@
 import android.widget.TextView;
 
 import com.android.inputmethod.keyboard.Keyboard;
-import com.android.inputmethod.keyboard.KeyboardSwitcher;
 import com.android.inputmethod.keyboard.MainKeyboardView;
 import com.android.inputmethod.keyboard.MoreKeysPanel;
 import com.android.inputmethod.latin.AudioAndHapticFeedbackManager;
@@ -281,8 +280,8 @@
     private final MoreKeysPanel.Controller mMoreSuggestionsController =
             new MoreKeysPanel.Controller() {
         @Override
-        public void onDismissMoreKeysPanel(final MoreKeysPanel panel) {
-            mMainKeyboardView.onDismissMoreKeysPanel(panel);
+        public void onDismissMoreKeysPanel() {
+            mMainKeyboardView.onDismissMoreKeysPanel();
         }
 
         @Override
@@ -291,7 +290,7 @@
         }
 
         @Override
-        public void onCancelMoreKeysPanel(final MoreKeysPanel panel) {
+        public void onCancelMoreKeysPanel() {
             dismissMoreSuggestionsPanel();
         }
     };
@@ -312,7 +311,7 @@
     }
 
     boolean showMoreSuggestions() {
-        final Keyboard parentKeyboard = KeyboardSwitcher.getInstance().getKeyboard();
+        final Keyboard parentKeyboard = mMainKeyboardView.getKeyboard();
         if (parentKeyboard == null) {
             return false;
         }
@@ -320,6 +319,12 @@
         if (!layoutHelper.mMoreSuggestionsAvailable) {
             return false;
         }
+        // Dismiss another {@link MoreKeysPanel} that may be being showed, for example
+        // {@link MoreKeysKeyboardView}.
+        mMainKeyboardView.onDismissMoreKeysPanel();
+        // Dismiss all key previews and sliding key input preview that may be being showed.
+        mMainKeyboardView.dismissAllKeyPreviews();
+        mMainKeyboardView.dismissSlidingKeyInputPreview();
         final int stripWidth = getWidth();
         final View container = mMoreSuggestionsContainer;
         final int maxWidth = stripWidth - container.getPaddingLeft() - container.getPaddingRight();
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetActionLabelTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetActionLabelTests.java
new file mode 100644
index 0000000..06139b8
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetActionLabelTests.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.android.inputmethod.keyboard;
+
+import android.content.res.Resources;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.text.InputType;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
+import com.android.inputmethod.latin.Constants;
+import com.android.inputmethod.latin.R;
+import com.android.inputmethod.latin.utils.RunInLocale;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@MediumTest
+public final class KeyboardLayoutSetActionLabelTests extends KeyboardLayoutSetTestsBase {
+    private static void doTestActionKey(final String tag, final KeyboardLayoutSet layoutSet,
+            final int elementId, final String label, final int iconId) {
+        final Keyboard keyboard = layoutSet.getKeyboard(elementId);
+        final Key enterKey = keyboard.getKey(Constants.CODE_ENTER);
+        assertNotNull(tag + " enter key on " + keyboard.mId, enterKey);
+        assertEquals(tag + " enter label " + enterKey, label, enterKey.getLabel());
+        assertEquals(tag + " enter icon " + enterKey, iconId, enterKey.getIconId());
+    }
+
+    private void doTestActionLabel(final String tag, final InputMethodSubtype subtype,
+            final int actionId, final int labelResId) {
+        final EditorInfo editorInfo = new EditorInfo();
+        editorInfo.imeOptions = actionId;
+        final RunInLocale<String> job = new RunInLocale<String>() {
+            @Override
+            protected String job(final Resources res) {
+                return res.getString(labelResId);
+            }
+        };
+        final Resources res = getContext().getResources();
+        final String label;
+        if (subtype.getLocale().equals(SubtypeLocaleUtils.NO_LANGUAGE)) {
+            // Using system locale.
+            label = res.getString(labelResId);
+        } else {
+            label = job.runInLocale(res, SubtypeLocaleUtils.getSubtypeLocale(subtype));
+        }
+        // Test text layouts.
+        editorInfo.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL;
+        final KeyboardLayoutSet layoutSet = createKeyboardLayoutSet(subtype, editorInfo);
+        doTestActionKey(tag, layoutSet, KeyboardId.ELEMENT_ALPHABET,
+                label, KeyboardIconsSet.ICON_UNDEFINED);
+        doTestActionKey(tag, layoutSet, KeyboardId.ELEMENT_SYMBOLS,
+                label, KeyboardIconsSet.ICON_UNDEFINED);
+        doTestActionKey(tag, layoutSet, KeyboardId.ELEMENT_SYMBOLS_SHIFTED,
+                label, KeyboardIconsSet.ICON_UNDEFINED);
+        // Test phone number layouts.
+        doTestActionKey(tag, layoutSet, KeyboardId.ELEMENT_PHONE,
+                label, KeyboardIconsSet.ICON_UNDEFINED);
+        doTestActionKey(tag, layoutSet, KeyboardId.ELEMENT_PHONE_SYMBOLS,
+                label, KeyboardIconsSet.ICON_UNDEFINED);
+        // Test normal number layout.
+        doTestActionKey(tag, layoutSet, KeyboardId.ELEMENT_NUMBER,
+                label, KeyboardIconsSet.ICON_UNDEFINED);
+        // Test number password layouts.
+        editorInfo.inputType =
+                InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD;
+        final KeyboardLayoutSet passwordSet = createKeyboardLayoutSet(subtype, editorInfo);
+        doTestActionKey(tag, passwordSet, KeyboardId.ELEMENT_NUMBER,
+                label, KeyboardIconsSet.ICON_UNDEFINED);
+    }
+
+    private void doTestActionKeyIcon(final String tag, final InputMethodSubtype subtype,
+            final int actionId, final String iconName) {
+        final int iconId = KeyboardIconsSet.getIconId(iconName);
+        final EditorInfo editorInfo = new EditorInfo();
+        editorInfo.imeOptions = actionId;
+        // Test text layouts.
+        editorInfo.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL;
+        final KeyboardLayoutSet layoutSet = createKeyboardLayoutSet(subtype, editorInfo);
+        doTestActionKey(tag, layoutSet, KeyboardId.ELEMENT_ALPHABET, null /* label */, iconId);
+        doTestActionKey(tag, layoutSet, KeyboardId.ELEMENT_SYMBOLS, null /* label */, iconId);
+        doTestActionKey(
+                tag, layoutSet, KeyboardId.ELEMENT_SYMBOLS_SHIFTED, null /* label */, iconId);
+        // Test phone number layouts.
+        doTestActionKey(tag, layoutSet, KeyboardId.ELEMENT_PHONE, null /* label */, iconId);
+        doTestActionKey(
+                tag, layoutSet, KeyboardId.ELEMENT_PHONE_SYMBOLS, null /* label */, iconId);
+        // Test normal number layout.
+        doTestActionKey(tag, layoutSet, KeyboardId.ELEMENT_NUMBER, null /* label */, iconId);
+        // Test number password layout.
+        editorInfo.inputType =
+                InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD;
+        final KeyboardLayoutSet passwordSet = createKeyboardLayoutSet(subtype, editorInfo);
+        doTestActionKey(tag, passwordSet, KeyboardId.ELEMENT_NUMBER, null /* label */, iconId);
+    }
+
+    public void testActionUnspecified() {
+        for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+            final String tag = "unspecifiled "
+                    + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+            doTestActionKeyIcon(tag, subtype, EditorInfo.IME_ACTION_UNSPECIFIED, "enter_key");
+        }
+    }
+
+    public void testActionNone() {
+        for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+            final String tag = "none " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+            doTestActionKeyIcon(tag, subtype, EditorInfo.IME_ACTION_NONE, "enter_key");
+        }
+    }
+
+    public void testActionGo() {
+        for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+            final String tag = "go " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+            doTestActionLabel(tag, subtype, EditorInfo.IME_ACTION_GO, R.string.label_go_key);
+        }
+    }
+
+    public void testActionSearch() {
+        for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+            final String tag = "search " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+            doTestActionKeyIcon(tag, subtype, EditorInfo.IME_ACTION_SEARCH, "search_key");
+        }
+    }
+
+    public void testActionSend() {
+        for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+            final String tag = "send " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+            doTestActionLabel(tag, subtype, EditorInfo.IME_ACTION_SEND, R.string.label_send_key);
+        }
+    }
+
+    public void testActionNext() {
+        for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+            final String tag = "next " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+            doTestActionLabel(tag, subtype, EditorInfo.IME_ACTION_NEXT, R.string.label_next_key);
+        }
+    }
+
+    public void testActionDone() {
+        for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+            final String tag = "done " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+            doTestActionLabel(tag, subtype, EditorInfo.IME_ACTION_DONE, R.string.label_done_key);
+        }
+    }
+
+    public void testActionPrevious() {
+        for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+            final String tag = "previous " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+            doTestActionLabel(
+                    tag, subtype, EditorInfo.IME_ACTION_PREVIOUS, R.string.label_previous_key);
+        }
+    }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java
new file mode 100644
index 0000000..e691639
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.android.inputmethod.keyboard;
+
+import android.test.suitebuilder.annotation.SmallTest;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+import java.util.ArrayList;
+
+@SmallTest
+public class KeyboardLayoutSetSubtypesCountTests extends KeyboardLayoutSetTestsBase {
+    private static final int NUMBER_OF_SUBTYPES = 63;
+    private static final int NUMBER_OF_ASCII_CAPABLE_SUBTYPES = 40;
+    private static final int NUMBER_OF_PREDEFINED_ADDITIONAL_SUBTYPES = 2;
+
+    private static String toString(final ArrayList<InputMethodSubtype> subtypeList) {
+        final StringBuilder sb = new StringBuilder();
+        for (int index = 0; index < subtypeList.size(); index++) {
+            final InputMethodSubtype subtype = subtypeList.get(index);
+            sb.append(index + ": ");
+            sb.append(SubtypeLocaleUtils.getSubtypeNameForLogging(subtype));
+            sb.append("\n");
+        }
+        return sb.toString();
+    }
+
+    public final void testAllSubtypesCount() {
+        final ArrayList<InputMethodSubtype> allSubtypesList = getAllSubtypesList();
+        assertEquals(toString(allSubtypesList), NUMBER_OF_SUBTYPES, allSubtypesList.size());
+    }
+
+    public final void testAsciiCapableSubtypesCount() {
+        final ArrayList<InputMethodSubtype> asciiCapableSubtypesList =
+                getAsciiCapableSubtypesList();
+        assertEquals(toString(asciiCapableSubtypesList),
+                NUMBER_OF_ASCII_CAPABLE_SUBTYPES, asciiCapableSubtypesList.size());
+    }
+
+    public final void testAdditionalSubtypesCount() {
+        final ArrayList<InputMethodSubtype> additionalSubtypesList = getAdditionalSubtypesList();
+        assertEquals(toString(additionalSubtypesList),
+                NUMBER_OF_PREDEFINED_ADDITIONAL_SUBTYPES, additionalSubtypesList.size());
+    }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java
index cd97fc9..0993c4b 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java
@@ -41,10 +41,6 @@
 
 @SmallTest
 public class KeyboardLayoutSetTestsBase extends AndroidTestCase {
-    private static final int NUMBER_OF_SUBTYPES = 63;
-    private static final int NUMBER_OF_ASCII_CAPABLE_SUBTYPES = 40;
-    private static final int NUMBER_OF_PREDEFINED_ADDITIONAL_SUBTYPES = 2;
-
     private static final KeyboardTheme DEFAULT_KEYBOARD_THEME =
             KeyboardSwitcher.KEYBOARD_THEMES[KeyboardSwitcher.THEME_INDEX_DEFAULT];
 
@@ -82,37 +78,23 @@
         }
     }
 
+    protected final ArrayList<InputMethodSubtype> getAllSubtypesList() {
+        return mAllSubtypesList;
+    }
+
+    protected final ArrayList<InputMethodSubtype> getAsciiCapableSubtypesList() {
+        return mAsciiCapableSubtypesList;
+    }
+
+    protected final ArrayList<InputMethodSubtype> getAdditionalSubtypesList() {
+        return mAdditionalSubtypesList;
+    }
+
     protected final boolean isPhone() {
         return mScreenMetrics == Constants.SCREEN_METRICS_SMALL_PHONE
                 || mScreenMetrics == Constants.SCREEN_METRICS_LARGE_PHONE;
     }
 
-    private static String toString(final ArrayList<InputMethodSubtype> subtypeList) {
-        final StringBuilder sb = new StringBuilder();
-        for (int index = 0; index < subtypeList.size(); index++) {
-            final InputMethodSubtype subtype = subtypeList.get(index);
-            sb.append(index + ": ");
-            sb.append(SubtypeLocaleUtils.getSubtypeNameForLogging(subtype));
-            sb.append("\n");
-        }
-        return sb.toString();
-    }
-
-    public final void testAllSubtypesCount() {
-        assertEquals(toString(mAllSubtypesList),
-                NUMBER_OF_SUBTYPES, mAllSubtypesList.size());
-    }
-
-    public final void testAsciiCapableSubtypesCount() {
-        assertEquals(toString(mAsciiCapableSubtypesList),
-                NUMBER_OF_ASCII_CAPABLE_SUBTYPES, mAsciiCapableSubtypesList.size());
-    }
-
-    public final void testAdditionalSubtypesCount() {
-        assertEquals(toString(mAdditionalSubtypesList),
-                NUMBER_OF_PREDEFINED_ADDITIONAL_SUBTYPES, mAdditionalSubtypesList.size());
-    }
-
     protected final InputMethodSubtype getSubtype(final Locale locale,
             final String keyboardLayout) {
         for (final InputMethodSubtype subtype : mAllSubtypesList) {