diff --git a/java/src/com/android/inputmethod/deprecated/recorrection/RecorrectionSuggestionEntries.java b/java/src/com/android/inputmethod/deprecated/recorrection/RecorrectionSuggestionEntries.java
index f33a462..36ffe2d 100644
--- a/java/src/com/android/inputmethod/deprecated/recorrection/RecorrectionSuggestionEntries.java
+++ b/java/src/com/android/inputmethod/deprecated/recorrection/RecorrectionSuggestionEntries.java
@@ -57,7 +57,7 @@
 
     private static SuggestedWords.Builder getTypedSuggestions(
             Suggest suggest, KeyboardSwitcher keyboardSwitcher, WordComposer word) {
-        return suggest.getSuggestedWordBuilder(keyboardSwitcher.getKeyboardView(), word, null,
+        return suggest.getSuggestedWordBuilder(word, null,
                 keyboardSwitcher.getLatinKeyboard().getProximityInfo());
     }
 }
diff --git a/java/src/com/android/inputmethod/latin/AutoCorrection.java b/java/src/com/android/inputmethod/latin/AutoCorrection.java
index e6ae2c5..fc97710 100644
--- a/java/src/com/android/inputmethod/latin/AutoCorrection.java
+++ b/java/src/com/android/inputmethod/latin/AutoCorrection.java
@@ -50,7 +50,7 @@
     public void updateAutoCorrectionStatus(Map<String, Dictionary> dictionaries,
             WordComposer wordComposer, ArrayList<CharSequence> suggestions, int[] sortedScores,
             CharSequence typedWord, double autoCorrectionThreshold, int correctionMode,
-            CharSequence quickFixedWord, CharSequence whitelistedWord) {
+            CharSequence whitelistedWord) {
         if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
             mHasAutoCorrection = true;
             mAutoCorrectionWord = whitelistedWord;
@@ -58,9 +58,6 @@
                 dictionaries, wordComposer, suggestions, typedWord, correctionMode)) {
             mHasAutoCorrection = true;
             mAutoCorrectionWord = typedWord;
-        } else if (hasAutoCorrectionForQuickFix(quickFixedWord)) {
-            mHasAutoCorrection = true;
-            mAutoCorrectionWord = quickFixedWord;
         } else if (hasAutoCorrectionForBinaryDictionary(wordComposer, suggestions, correctionMode,
                 sortedScores, typedWord, autoCorrectionThreshold)) {
             mHasAutoCorrection = true;
@@ -109,10 +106,6 @@
                 || correctionMode == Suggest.CORRECTION_FULL_BIGRAM);
     }
 
-    private static boolean hasAutoCorrectionForQuickFix(CharSequence quickFixedWord) {
-        return quickFixedWord != null;
-    }
-
     private boolean hasAutoCorrectionForBinaryDictionary(WordComposer wordComposer,
             ArrayList<CharSequence> suggestions, int correctionMode, int[] sortedScores,
             CharSequence typedWord, double autoCorrectionThreshold) {
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index dfb4d06..777881c 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -550,7 +550,6 @@
         if (mSettingsValues.mAutoCorrectEnabled) {
             mSuggest.setAutoCorrectionThreshold(mSettingsValues.mAutoCorrectionThreshold);
         }
-        updateAutoTextEnabled();
 
         mUserDictionary = new UserDictionary(this, localeStr);
         mSuggest.setUserDictionary(mUserDictionary);
@@ -734,7 +733,6 @@
 
         loadSettings();
         updateCorrectionMode();
-        updateAutoTextEnabled();
         updateSuggestionVisibility(mPrefs, mResources);
 
         if (mSuggest != null && mSettingsValues.mAutoCorrectEnabled) {
@@ -1673,8 +1671,7 @@
         }
         // getSuggestedWordBuilder handles gracefully a null value of prevWord
         final SuggestedWords.Builder builder = mSuggest.getSuggestedWordBuilder(
-                mKeyboardSwitcher.getKeyboardView(), wordComposer, prevWord,
-                mKeyboardSwitcher.getLatinKeyboard().getProximityInfo());
+                wordComposer, prevWord, mKeyboardSwitcher.getLatinKeyboard().getProximityInfo());
 
         boolean autoCorrectionAvailable = !mInputTypeNoAutoCorrect && mSuggest.hasAutoCorrection();
         final CharSequence typedWord = wordComposer.getTypedWord();
@@ -1907,9 +1904,8 @@
 
         final CharSequence prevWord = EditingUtils.getThisWord(getCurrentInputConnection(),
                 mSettingsValues.mWordSeparators);
-        SuggestedWords.Builder builder = mSuggest.getSuggestedWordBuilder(
-                mKeyboardSwitcher.getKeyboardView(), sEmptyWordComposer, prevWord,
-                mKeyboardSwitcher.getLatinKeyboard().getProximityInfo());
+        SuggestedWords.Builder builder = mSuggest.getSuggestedWordBuilder(sEmptyWordComposer,
+                prevWord, mKeyboardSwitcher.getLatinKeyboard().getProximityInfo());
 
         if (builder.size() > 0) {
             // Explicitly supply an empty typed word (the no-second-arg version of
@@ -2214,18 +2210,6 @@
         }
     }
 
-    private void updateAutoTextEnabled() {
-        if (mSuggest == null) return;
-        // We want to use autotext if the settings are asking for auto corrections, and if
-        // the input language is the same as the system language (because autotext will only
-        // work in the system language so if we are entering text in a different language we
-        // do not want it on).
-        // We used to look at the "quick fixes" option instead of mAutoCorrectEnabled, but
-        // this option was redundant and confusing and therefore removed.
-        mSuggest.setQuickFixesEnabled(mSettingsValues.mAutoCorrectEnabled
-                && SubtypeSwitcher.getInstance().isSystemLanguageSameAsInputLanguage());
-    }
-
     private void updateSuggestionVisibility(final SharedPreferences prefs, final Resources res) {
         final String suggestionVisiblityStr = prefs.getString(
                 Settings.PREF_SHOW_SUGGESTIONS_SETTING,
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 16dccf8..208fd13 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -17,10 +17,8 @@
 package com.android.inputmethod.latin;
 
 import android.content.Context;
-import android.text.AutoText;
 import android.text.TextUtils;
 import android.util.Log;
-import android.view.View;
 
 import com.android.inputmethod.keyboard.ProximityInfo;
 
@@ -97,8 +95,6 @@
 
     private static final int PREF_MAX_BIGRAMS = 60;
 
-    private boolean mQuickFixesEnabled;
-
     private double mAutoCorrectionThreshold;
     private int[] mScores = new int[mPrefMaxSuggestions];
     private int[] mBigramScores = new int[PREF_MAX_BIGRAMS];
@@ -160,6 +156,7 @@
             final Locale locale) {
         mMainDict = null;
         new Thread("InitializeBinaryDictionary") {
+            @Override
             public void run() {
                 final Dictionary newMainDict = DictionaryFactory.createDictionaryFromManager(
                         context, locale, dictionaryResId);
@@ -170,11 +167,6 @@
         }.start();
     }
 
-
-    public void setQuickFixesEnabled(boolean enabled) {
-        mQuickFixesEnabled = enabled;
-    }
-
     public int getCorrectionMode() {
         return mCorrectionMode;
     }
@@ -256,14 +248,13 @@
     /**
      * Returns a object which represents suggested words that match the list of character codes
      * passed in. This object contents will be overwritten the next time this function is called.
-     * @param view a view for retrieving the context for AutoText
      * @param wordComposer contains what is currently being typed
      * @param prevWordForBigram previous word (used only for bigram)
      * @return suggested words object.
      */
-    public SuggestedWords getSuggestions(final View view, final WordComposer wordComposer,
+    public SuggestedWords getSuggestions(final WordComposer wordComposer,
             final CharSequence prevWordForBigram, final ProximityInfo proximityInfo) {
-        return getSuggestedWordBuilder(view, wordComposer, prevWordForBigram,
+        return getSuggestedWordBuilder(wordComposer, prevWordForBigram,
                 proximityInfo).build();
     }
 
@@ -295,7 +286,7 @@
     }
 
     // TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder
-    public SuggestedWords.Builder getSuggestedWordBuilder(final View view,
+    public SuggestedWords.Builder getSuggestedWordBuilder(
             final WordComposer wordComposer, CharSequence prevWordForBigram,
             final ProximityInfo proximityInfo) {
         LatinImeLogger.onStartSuggestion(prevWordForBigram);
@@ -336,6 +327,7 @@
                     }
                 } else {
                     // Word entered: return only bigrams that match the first char of the typed word
+                    @SuppressWarnings("null")
                     final char currentChar = typedWord.charAt(0);
                     // TODO: Must pay attention to locale when changing case.
                     final char currentCharUpper = Character.toUpperCase(currentChar);
@@ -363,34 +355,14 @@
                 dictionary.getWords(wordComposer, this, proximityInfo);
             }
         }
-        CharSequence autoText = null;
         final String typedWordString = typedWord == null ? null : typedWord.toString();
-        if (typedWord != null) {
-            // Apply quick fix only for the typed word.
-            if (mQuickFixesEnabled) {
-                final String lowerCaseTypedWord = typedWordString.toLowerCase();
-                // Is there an AutoText (also known as Quick Fixes) correction?
-                // Capitalize as needed
-                autoText = capitalizeWord(mIsAllUpperCase, mIsFirstCharCapitalized, AutoText.get(
-                        lowerCaseTypedWord, 0, lowerCaseTypedWord.length(), view));
-                if (DBG) {
-                    if (autoText != null) {
-                        Log.d(TAG, "Auto corrected by AUTOTEXT: " + typedWord + " -> " + autoText);
-                    }
-                }
-            }
-        }
 
         CharSequence whitelistedWord = capitalizeWord(mIsAllUpperCase, mIsFirstCharCapitalized,
                 mWhiteListDictionary.getWhiteListedWord(typedWordString));
 
         mAutoCorrection.updateAutoCorrectionStatus(mUnigramDictionaries, wordComposer,
                 mSuggestions, mScores, typedWord, mAutoCorrectionThreshold, mCorrectionMode,
-                autoText, whitelistedWord);
-
-        if (autoText != null) {
-            mSuggestions.add(0, autoText);
-        }
+                whitelistedWord);
 
         if (whitelistedWord != null) {
             mSuggestions.add(0, whitelistedWord);
diff --git a/tests/src/com/android/inputmethod/latin/SuggestHelper.java b/tests/src/com/android/inputmethod/latin/SuggestHelper.java
index 48fe817..43b8cf6 100644
--- a/tests/src/com/android/inputmethod/latin/SuggestHelper.java
+++ b/tests/src/com/android/inputmethod/latin/SuggestHelper.java
@@ -49,7 +49,6 @@
     }
 
     private void init() {
-        mSuggest.setQuickFixesEnabled(false);
         mSuggest.setCorrectionMode(Suggest.CORRECTION_FULL);
         mKeyDetector.setKeyboard(mKeyboard, 0, 0);
         mKeyDetector.setProximityCorrectionEnabled(true);
@@ -94,13 +93,13 @@
 
     // TODO: This may be slow, but is OK for test so far.
     public SuggestedWords getSuggestions(CharSequence typed) {
-        return mSuggest.getSuggestions(null, createWordComposer(typed), null,
+        return mSuggest.getSuggestions(createWordComposer(typed), null,
                 mKeyboard.getProximityInfo());
     }
 
     public CharSequence getFirstSuggestion(CharSequence typed) {
         WordComposer word = createWordComposer(typed);
-        SuggestedWords suggestions = mSuggest.getSuggestions(null, word, null,
+        SuggestedWords suggestions = mSuggest.getSuggestions(word, null,
                 mKeyboard.getProximityInfo());
         // Note that suggestions.getWord(0) is the word user typed.
         return suggestions.size() > 1 ? suggestions.getWord(1) : null;
@@ -108,7 +107,7 @@
 
     public CharSequence getAutoCorrection(CharSequence typed) {
         WordComposer word = createWordComposer(typed);
-        SuggestedWords suggestions = mSuggest.getSuggestions(null, word, null,
+        SuggestedWords suggestions = mSuggest.getSuggestions(word, null,
                 mKeyboard.getProximityInfo());
         // Note that suggestions.getWord(0) is the word user typed.
         return (suggestions.size() > 1 && mSuggest.hasAutoCorrection())
@@ -117,7 +116,7 @@
 
     public int getSuggestIndex(CharSequence typed, CharSequence expected) {
         WordComposer word = createWordComposer(typed);
-        SuggestedWords suggestions = mSuggest.getSuggestions(null, word, null,
+        SuggestedWords suggestions = mSuggest.getSuggestions(word, null,
                 mKeyboard.getProximityInfo());
         // Note that suggestions.getWord(0) is the word user typed.
         for (int i = 1; i < suggestions.size(); i++) {
@@ -130,14 +129,14 @@
     private void getBigramSuggestions(CharSequence previous, CharSequence typed) {
         if (!TextUtils.isEmpty(previous) && (typed.length() > 1)) {
             WordComposer firstChar = createWordComposer(Character.toString(typed.charAt(0)));
-            mSuggest.getSuggestions(null, firstChar, previous, mKeyboard.getProximityInfo());
+            mSuggest.getSuggestions(firstChar, previous, mKeyboard.getProximityInfo());
         }
     }
 
     public CharSequence getBigramFirstSuggestion(CharSequence previous, CharSequence typed) {
         WordComposer word = createWordComposer(typed);
         getBigramSuggestions(previous, typed);
-        SuggestedWords suggestions = mSuggest.getSuggestions(null, word, previous,
+        SuggestedWords suggestions = mSuggest.getSuggestions(word, previous,
                 mKeyboard.getProximityInfo());
         return suggestions.size() > 1 ? suggestions.getWord(1) : null;
     }
@@ -145,7 +144,7 @@
     public CharSequence getBigramAutoCorrection(CharSequence previous, CharSequence typed) {
         WordComposer word = createWordComposer(typed);
         getBigramSuggestions(previous, typed);
-        SuggestedWords suggestions = mSuggest.getSuggestions(null, word, previous,
+        SuggestedWords suggestions = mSuggest.getSuggestions(word, previous,
                 mKeyboard.getProximityInfo());
         return (suggestions.size() > 1 && mSuggest.hasAutoCorrection())
                 ? suggestions.getWord(1) : null;
@@ -155,7 +154,7 @@
             CharSequence expected) {
         WordComposer word = createWordComposer(typed);
         getBigramSuggestions(previous, typed);
-        SuggestedWords suggestions = mSuggest.getSuggestions(null, word, previous,
+        SuggestedWords suggestions = mSuggest.getSuggestions(word, previous,
                 mKeyboard.getProximityInfo());
         for (int i = 1; i < suggestions.size(); i++) {
             if (TextUtils.equals(suggestions.getWord(i), expected))
diff --git a/tests/src/com/android/inputmethod/latin/UserBigramSuggestHelper.java b/tests/src/com/android/inputmethod/latin/UserBigramSuggestHelper.java
index a7d532e..7efd5d0 100644
--- a/tests/src/com/android/inputmethod/latin/UserBigramSuggestHelper.java
+++ b/tests/src/com/android/inputmethod/latin/UserBigramSuggestHelper.java
@@ -58,7 +58,7 @@
         flushUserBigrams();
         if (!TextUtils.isEmpty(previous) && !TextUtils.isEmpty(Character.toString(typed))) {
             WordComposer firstChar = createWordComposer(Character.toString(typed));
-            mSuggest.getSuggestions(null, firstChar, previous, mKeyboard.getProximityInfo());
+            mSuggest.getSuggestions(firstChar, previous, mKeyboard.getProximityInfo());
             boolean reloading = mUserBigram.reloadDictionaryIfRequired();
             if (reloading) mUserBigram.waitForDictionaryLoading();
             mUserBigram.getBigrams(firstChar, previous, mSuggest);
