diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml
index ebca250..c5c647a 100644
--- a/java/res/xml/prefs.xml
+++ b/java/res/xml/prefs.xml
@@ -21,9 +21,6 @@
     <PreferenceCategory
         android:title="@string/general_category"
         android:key="general_settings">
-        <PreferenceScreen
-            android:key="subtype_settings"
-            android:title="@string/language_selection_title" />
         <CheckBoxPreference
             android:key="auto_cap"
             android:title="@string/auto_cap"
diff --git a/java/src/com/android/inputmethod/compat/CompatUtils.java b/java/src/com/android/inputmethod/compat/CompatUtils.java
index ba82a06..f1f6a12 100644
--- a/java/src/com/android/inputmethod/compat/CompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/CompatUtils.java
@@ -35,23 +35,16 @@
 
     public static Intent getInputLanguageSelectionIntent(String inputMethodId,
             int flagsForSubtypeSettings) {
-        final String action;
-        Intent intent;
-        if (InputMethodServiceCompatWrapper.CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED
-                /* android.os.Build.VERSION_CODES.HONEYCOMB */
-                && android.os.Build.VERSION.SDK_INT >=  11) {
-            // Refer to android.provider.Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS
-            action = INPUT_METHOD_SUBTYPE_SETTINGS;
-            intent = new Intent(action);
-            if (!TextUtils.isEmpty(inputMethodId)) {
-                intent.putExtra(EXTRA_INPUT_METHOD_ID, inputMethodId);
-            }
-            if (flagsForSubtypeSettings > 0) {
-                intent.setFlags(flagsForSubtypeSettings);
-            }
-            return intent;
+        // Refer to android.provider.Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS
+        final String action = INPUT_METHOD_SUBTYPE_SETTINGS;
+        final Intent intent = new Intent(action);
+        if (!TextUtils.isEmpty(inputMethodId)) {
+            intent.putExtra(EXTRA_INPUT_METHOD_ID, inputMethodId);
         }
-        throw new RuntimeException("Language selection doesn't supported on this platform");
+        if (flagsForSubtypeSettings > 0) {
+            intent.setFlags(flagsForSubtypeSettings);
+        }
+        return intent;
     }
 
     public static Class<?> getClass(String className) {
diff --git a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
index cf6b379..0f03c2e 100644
--- a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
+++ b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
@@ -17,23 +17,15 @@
 package com.android.inputmethod.compat;
 
 import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
 import android.os.IBinder;
-import android.text.TextUtils;
 import android.util.Log;
 import android.view.inputmethod.InputMethodInfo;
 import android.view.inputmethod.InputMethodManager;
 
-import com.android.inputmethod.latin.SubtypeSwitcher;
-import com.android.inputmethod.latin.SubtypeUtils;
-
 import java.lang.reflect.Method;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 
 // TODO: Override this class with the concrete implementation if we need to take care of the
@@ -61,18 +53,7 @@
     private static final InputMethodManagerCompatWrapper sInstance =
             new InputMethodManagerCompatWrapper();
 
-    // For the compatibility, IMM will create dummy subtypes if subtypes are not found.
-    // This is required to be false if the current behavior is broken. For now, it's ok to be true.
-    public static final boolean FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES =
-            !InputMethodServiceCompatWrapper.CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED;
-    private static final String VOICE_MODE = "voice";
-    private static final String KEYBOARD_MODE = "keyboard";
-
-    private InputMethodServiceCompatWrapper mService;
     private InputMethodManager mImm;
-    private PackageManager mPackageManager;
-    private ApplicationInfo mApplicationInfo;
-    private String mLatinImePackageName;
 
     public static InputMethodManagerCompatWrapper getInstance() {
         if (sInstance.mImm == null)
@@ -81,12 +62,8 @@
     }
 
     public static void init(InputMethodServiceCompatWrapper service) {
-        sInstance.mService = service;
         sInstance.mImm = (InputMethodManager) service.getSystemService(
                 Context.INPUT_METHOD_SERVICE);
-        sInstance.mLatinImePackageName = service.getPackageName();
-        sInstance.mPackageManager = service.getPackageManager();
-        sInstance.mApplicationInfo = service.getApplicationInfo();
     }
 
     public InputMethodSubtypeCompatWrapper getCurrentInputMethodSubtype() {
@@ -104,67 +81,18 @@
         Object retval = CompatUtils.invoke(mImm, null, METHOD_getEnabledInputMethodSubtypeList,
                 imi, allowsImplicitlySelectedSubtypes);
         if (retval == null || !(retval instanceof List<?>) || ((List<?>)retval).isEmpty()) {
-            if (!FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES) {
-                // Returns an empty list
-                return Collections.emptyList();
-            }
-            // Creates dummy subtypes
-            @SuppressWarnings("unused")
-            List<InputMethodSubtypeCompatWrapper> subtypeList =
-                    new ArrayList<InputMethodSubtypeCompatWrapper>();
-            InputMethodSubtypeCompatWrapper keyboardSubtype = getLastResortSubtype(KEYBOARD_MODE);
-            InputMethodSubtypeCompatWrapper voiceSubtype = getLastResortSubtype(VOICE_MODE);
-            if (keyboardSubtype != null) {
-                subtypeList.add(keyboardSubtype);
-            }
-            if (voiceSubtype != null) {
-                subtypeList.add(voiceSubtype);
-            }
-            return subtypeList;
+            // Returns an empty list
+            return Collections.emptyList();
         }
         return CompatUtils.copyInputMethodSubtypeListToWrapper(retval);
     }
 
-    private InputMethodInfo getLatinImeInputMethodInfo() {
-        if (TextUtils.isEmpty(mLatinImePackageName))
-            return null;
-        return SubtypeUtils.getInputMethodInfo(mLatinImePackageName);
-    }
-
-    private static InputMethodSubtypeCompatWrapper getLastResortSubtype(String mode) {
-        if (VOICE_MODE.equals(mode) && !FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES)
-            return null;
-        Locale inputLocale = SubtypeSwitcher.getInstance().getInputLocale();
-        if (inputLocale == null)
-            return null;
-        return new InputMethodSubtypeCompatWrapper(0, 0, inputLocale.toString(), mode, "");
-    }
-
     public Map<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>>
             getShortcutInputMethodsAndSubtypes() {
         Object retval = CompatUtils.invoke(mImm, null, METHOD_getShortcutInputMethodsAndSubtypes);
         if (retval == null || !(retval instanceof Map<?, ?>) || ((Map<?, ?>)retval).isEmpty()) {
-            if (!FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES) {
-                // Returns an empty map
-                return Collections.emptyMap();
-            }
-            // Creates dummy subtypes
-            @SuppressWarnings("unused")
-            InputMethodInfo imi = getLatinImeInputMethodInfo();
-            InputMethodSubtypeCompatWrapper voiceSubtype = getLastResortSubtype(VOICE_MODE);
-            if (imi != null && voiceSubtype != null) {
-                Map<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>>
-                        shortcutMap =
-                                new HashMap<InputMethodInfo,
-                                        List<InputMethodSubtypeCompatWrapper>>();
-                List<InputMethodSubtypeCompatWrapper> subtypeList =
-                        new ArrayList<InputMethodSubtypeCompatWrapper>();
-                subtypeList.add(voiceSubtype);
-                shortcutMap.put(imi, subtypeList);
-                return shortcutMap;
-            } else {
-                return Collections.emptyMap();
-            }
+            // Returns an empty map
+            return Collections.emptyMap();
         }
         Map<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>> shortcutMap =
                 new HashMap<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>>();
diff --git a/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java
index 7c15be3..6386fed 100644
--- a/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java
+++ b/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java
@@ -27,15 +27,6 @@
 import com.android.inputmethod.latin.SubtypeSwitcher;
 
 public class InputMethodServiceCompatWrapper extends InputMethodService {
-    // CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED needs to be false if the API level is 10
-    // or previous. Note that InputMethodSubtype was added in the API level 11.
-    // For the API level 11 or later, LatinIME should override onCurrentInputMethodSubtypeChanged().
-    // For the API level 10 or previous, we handle the "subtype changed" events by ourselves
-    // without having support from framework -- onCurrentInputMethodSubtypeChanged().
-    public static final boolean CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED = true;
-
-    private InputMethodManagerCompatWrapper mImm;
-
     // For compatibility of {@link InputMethodManager#showInputMethodPicker}.
     // TODO: Move this variable back to LatinIME when this compatibility wrapper is removed.
     protected AlertDialog mOptionsDialog;
@@ -62,32 +53,6 @@
     @Override
     public void onCreate() {
         super.onCreate();
-        mImm = InputMethodManagerCompatWrapper.getInstance();
-    }
-
-    // When the API level is 10 or previous, notifyOnCurrentInputMethodSubtypeChanged should
-    // handle the event the current subtype was changed. LatinIME calls
-    // notifyOnCurrentInputMethodSubtypeChanged every time LatinIME
-    // changes the current subtype.
-    // This call is required to let LatinIME itself know a subtype changed
-    // event when the API level is 10 or previous.
-    @SuppressWarnings("unused")
-    public void notifyOnCurrentInputMethodSubtypeChanged(
-            InputMethodSubtypeCompatWrapper newSubtype) {
-        // Do nothing when the API level is 11 or later
-        // and FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES is not true
-        if (CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED && !InputMethodManagerCompatWrapper.
-                FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES) {
-            return;
-        }
-        final InputMethodSubtypeCompatWrapper subtype = (newSubtype == null)
-                ? mImm.getCurrentInputMethodSubtype()
-                : newSubtype;
-        if (subtype != null) {
-            if (!InputMethodManagerCompatWrapper.FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES
-                    && !subtype.isDummy()) return;
-            SubtypeSwitcher.getInstance().updateSubtype(subtype);
-        }
     }
 
     //////////////////////////////////////
@@ -95,8 +60,6 @@
     //////////////////////////////////////
     @Override
     public void onCurrentInputMethodSubtypeChanged(InputMethodSubtype subtype) {
-        // Do nothing when the API level is 10 or previous
-        if (!CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED) return;
         SubtypeSwitcher.getInstance().updateSubtype(
                 new InputMethodSubtypeCompatWrapper(subtype));
     }
diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java
index fd61292..7b98a71 100644
--- a/java/src/com/android/inputmethod/latin/Settings.java
+++ b/java/src/com/android/inputmethod/latin/Settings.java
@@ -18,7 +18,6 @@
 
 import android.app.Activity;
 import android.app.AlertDialog;
-import android.app.Dialog;
 import android.app.Fragment;
 import android.app.backup.BackupManager;
 import android.content.Context;
@@ -34,31 +33,20 @@
 import android.preference.Preference.OnPreferenceClickListener;
 import android.preference.PreferenceGroup;
 import android.preference.PreferenceScreen;
-import android.text.TextUtils;
-import android.text.method.LinkMovementMethod;
-import android.util.Log;
 import android.view.View;
 import android.widget.SeekBar;
 import android.widget.SeekBar.OnSeekBarChangeListener;
 import android.widget.TextView;
 
-import com.android.inputmethod.compat.CompatUtils;
-import com.android.inputmethod.compat.InputMethodServiceCompatWrapper;
-import com.android.inputmethod.latin.VibratorUtils;
 import com.android.inputmethod.latin.define.ProductionFlag;
 import com.android.inputmethodcommon.InputMethodSettingsActivity;
 
-import java.util.Locale;
-
 public class Settings extends InputMethodSettingsActivity
-        implements SharedPreferences.OnSharedPreferenceChangeListener, OnPreferenceClickListener {
-    private static final String TAG = Settings.class.getSimpleName();
-
+        implements SharedPreferences.OnSharedPreferenceChangeListener {
     public static final boolean ENABLE_EXPERIMENTAL_SETTINGS = false;
 
     // In the same order as xml/prefs.xml
     public static final String PREF_GENERAL_SETTINGS = "general_settings";
-    public static final String PREF_SUBTYPES_SETTINGS = "subtype_settings";
     public static final String PREF_AUTO_CAP = "auto_cap";
     public static final String PREF_VIBRATE_ON = "vibrate_on";
     public static final String PREF_SOUND_ON = "sound_on";
@@ -90,7 +78,6 @@
     public static final String PREF_SELECTED_LANGUAGES = "selected_languages";
     public static final String PREF_DEBUG_SETTINGS = "debug_settings";
 
-    private PreferenceScreen mInputLanguageSelection;
     private PreferenceScreen mKeypressVibrationDurationSettingsPref;
     private PreferenceScreen mKeypressSoundVolumeSettingsPref;
     private ListPreference mVoicePreference;
@@ -102,14 +89,10 @@
     // Prediction: use bigrams to predict the next word when there is no input for it yet
     private CheckBoxPreference mBigramPrediction;
     private Preference mDebugSettingsPreference;
-    private boolean mVoiceOn;
 
-    private AlertDialog mDialog;
     private TextView mKeypressVibrationDurationSettingsTextView;
     private TextView mKeypressSoundVolumeSettingsTextView;
 
-    private String mVoiceModeOff;
-
     private void ensureConsistencyOfAutoCorrectionSettings() {
         final String autoCorrectionOff = getResources().getString(
                 R.string.auto_correction_threshold_mode_index_off);
@@ -140,18 +123,12 @@
         final Context context = getActivityInternal();
 
         addPreferencesFromResource(R.xml.prefs);
-        mInputLanguageSelection = (PreferenceScreen) findPreference(PREF_SUBTYPES_SETTINGS);
-        mInputLanguageSelection.setOnPreferenceClickListener(this);
         mVoicePreference = (ListPreference) findPreference(PREF_VOICE_MODE);
         mShowCorrectionSuggestionsPreference =
                 (ListPreference) findPreference(PREF_SHOW_SUGGESTIONS_SETTING);
         SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
         prefs.registerOnSharedPreferenceChangeListener(this);
 
-        mVoiceModeOff = getString(R.string.voice_mode_off);
-        mVoiceOn = !(prefs.getString(PREF_VOICE_MODE, mVoiceModeOff)
-                .equals(mVoiceModeOff));
-
         mAutoCorrectionThresholdPreference =
                 (ListPreference) findPreference(PREF_AUTO_CORRECTION_THRESHOLD);
         mBigramSuggestion = (CheckBoxPreference) findPreference(PREF_BIGRAM_SUGGESTION);
@@ -183,10 +160,6 @@
             generalSettings.removePreference(findPreference(PREF_VIBRATE_ON));
         }
 
-        if (InputMethodServiceCompatWrapper.CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED) {
-            generalSettings.removePreference(findPreference(PREF_SUBTYPES_SETTINGS));
-        }
-
         final boolean showPopupOption = res.getBoolean(
                 R.bool.config_enable_show_popup_on_keypress_option);
         if (!showPopupOption) {
@@ -318,25 +291,12 @@
                     !SettingsValues.isLanguageSwitchKeySupressed(prefs));
         }
         ensureConsistencyOfAutoCorrectionSettings();
-        mVoiceOn = !(prefs.getString(PREF_VOICE_MODE, mVoiceModeOff)
-                .equals(mVoiceModeOff));
         updateVoiceModeSummary();
         updateShowCorrectionSuggestionsSummary();
         updateKeyPreviewPopupDelaySummary();
         refreshEnablingsOfKeypressSoundAndVibrationSettings(prefs, getResources());
     }
 
-    @Override
-    public boolean onPreferenceClick(Preference pref) {
-        if (pref == mInputLanguageSelection) {
-            final String imeId = SubtypeUtils.getInputMethodId(
-                    getActivityInternal().getApplicationInfo().packageName);
-            startActivity(CompatUtils.getInputLanguageSelectionIntent(imeId, 0));
-            return true;
-        }
-        return false;
-    }
-
     private void updateShowCorrectionSuggestionsSummary() {
         mShowCorrectionSuggestionsPreference.setSummary(
                 getResources().getStringArray(R.array.prefs_suggestion_visibilities)
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
index 5cdee14..794e5dc 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
@@ -300,17 +300,6 @@
                 mImm.setInputMethodAndSubtype(token, imiId, subtype);
                 return null;
             }
-
-            @Override
-            protected void onPostExecute(Void result) {
-                // Calls in this method need to be done in the same thread as the thread which
-                // called switchToShortcutIME().
-
-                // Notify an event that the current subtype was changed. This event will be
-                // handled if "onCurrentInputMethodSubtypeChanged" can't be implemented
-                // when the API level is 10 or previous.
-                mService.notifyOnCurrentInputMethodSubtypeChanged(subtype);
-            }
         }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
     }
 
