diff --git a/java/src/com/android/inputmethod/compat/InputMethodInfoCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodInfoCompatWrapper.java
deleted file mode 100644
index 8315598..0000000
--- a/java/src/com/android/inputmethod/compat/InputMethodInfoCompatWrapper.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-package com.android.inputmethod.compat;
-
-import android.content.pm.PackageManager;
-import android.content.pm.ServiceInfo;
-import android.view.inputmethod.InputMethodInfo;
-
-import java.lang.reflect.Method;
-
-public class InputMethodInfoCompatWrapper {
-    private final InputMethodInfo mImi;
-    private static final Method METHOD_getSubtypeAt = CompatUtils.getMethod(
-            InputMethodInfo.class, "getSubtypeAt", int.class);
-    private static final Method METHOD_getSubtypeCount = CompatUtils.getMethod(
-            InputMethodInfo.class, "getSubtypeCount");
-
-    public InputMethodInfoCompatWrapper(InputMethodInfo imi) {
-        mImi = imi;
-    }
-
-    public InputMethodInfo getInputMethodInfo() {
-        return mImi;
-    }
-
-    public String getId() {
-        return mImi.getId();
-    }
-
-    public String getPackageName() {
-        return mImi.getPackageName();
-    }
-
-    public ServiceInfo getServiceInfo() {
-        return mImi.getServiceInfo();
-    }
-
-    public int getSubtypeCount() {
-        return (Integer) CompatUtils.invoke(mImi, 0, METHOD_getSubtypeCount);
-    }
-
-    public InputMethodSubtypeCompatWrapper getSubtypeAt(int index) {
-        return new InputMethodSubtypeCompatWrapper(CompatUtils.invoke(mImi, null,
-                METHOD_getSubtypeAt, index));
-    }
-
-    public CharSequence loadLabel(PackageManager pm) {
-        return mImi.loadLabel(pm);
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (o instanceof InputMethodInfoCompatWrapper) {
-            return mImi.equals(((InputMethodInfoCompatWrapper)o).mImi);
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return mImi.hashCode();
-    }
-}
diff --git a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
index 3df6bea..cf6b379 100644
--- a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
+++ b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
@@ -16,11 +16,7 @@
 
 package com.android.inputmethod.compat;
 
-import android.app.AlertDialog;
 import android.content.Context;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
-import android.content.Intent;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.os.IBinder;
@@ -29,14 +25,12 @@
 import android.view.inputmethod.InputMethodInfo;
 import android.view.inputmethod.InputMethodManager;
 
-import com.android.inputmethod.latin.R;
 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.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
@@ -106,9 +100,9 @@
     }
 
     public List<InputMethodSubtypeCompatWrapper> getEnabledInputMethodSubtypeList(
-            InputMethodInfoCompatWrapper imi, boolean allowsImplicitlySelectedSubtypes) {
+            InputMethodInfo imi, boolean allowsImplicitlySelectedSubtypes) {
         Object retval = CompatUtils.invoke(mImm, null, METHOD_getEnabledInputMethodSubtypeList,
-                (imi != null ? imi.getInputMethodInfo() : null), allowsImplicitlySelectedSubtypes);
+                imi, allowsImplicitlySelectedSubtypes);
         if (retval == null || !(retval instanceof List<?>) || ((List<?>)retval).isEmpty()) {
             if (!FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES) {
                 // Returns an empty list
@@ -131,7 +125,7 @@
         return CompatUtils.copyInputMethodSubtypeListToWrapper(retval);
     }
 
-    private InputMethodInfoCompatWrapper getLatinImeInputMethodInfo() {
+    private InputMethodInfo getLatinImeInputMethodInfo() {
         if (TextUtils.isEmpty(mLatinImePackageName))
             return null;
         return SubtypeUtils.getInputMethodInfo(mLatinImePackageName);
@@ -146,7 +140,7 @@
         return new InputMethodSubtypeCompatWrapper(0, 0, inputLocale.toString(), mode, "");
     }
 
-    public Map<InputMethodInfoCompatWrapper, List<InputMethodSubtypeCompatWrapper>>
+    public Map<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>>
             getShortcutInputMethodsAndSubtypes() {
         Object retval = CompatUtils.invoke(mImm, null, METHOD_getShortcutInputMethodsAndSubtypes);
         if (retval == null || !(retval instanceof Map<?, ?>) || ((Map<?, ?>)retval).isEmpty()) {
@@ -156,12 +150,12 @@
             }
             // Creates dummy subtypes
             @SuppressWarnings("unused")
-            InputMethodInfoCompatWrapper imi = getLatinImeInputMethodInfo();
+            InputMethodInfo imi = getLatinImeInputMethodInfo();
             InputMethodSubtypeCompatWrapper voiceSubtype = getLastResortSubtype(VOICE_MODE);
             if (imi != null && voiceSubtype != null) {
-                Map<InputMethodInfoCompatWrapper, List<InputMethodSubtypeCompatWrapper>>
+                Map<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>>
                         shortcutMap =
-                                new HashMap<InputMethodInfoCompatWrapper,
+                                new HashMap<InputMethodInfo,
                                         List<InputMethodSubtypeCompatWrapper>>();
                 List<InputMethodSubtypeCompatWrapper> subtypeList =
                         new ArrayList<InputMethodSubtypeCompatWrapper>();
@@ -172,15 +166,15 @@
                 return Collections.emptyMap();
             }
         }
-        Map<InputMethodInfoCompatWrapper, List<InputMethodSubtypeCompatWrapper>> shortcutMap =
-                new HashMap<InputMethodInfoCompatWrapper, List<InputMethodSubtypeCompatWrapper>>();
+        Map<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>> shortcutMap =
+                new HashMap<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>>();
         final Map<?, ?> retvalMap = (Map<?, ?>)retval;
         for (Object key : retvalMap.keySet()) {
             if (!(key instanceof InputMethodInfo)) {
                 Log.e(TAG, "Class type error.");
                 return null;
             }
-            shortcutMap.put(new InputMethodInfoCompatWrapper((InputMethodInfo)key),
+            shortcutMap.put((InputMethodInfo)key,
                     CompatUtils.copyInputMethodSubtypeListToWrapper(retvalMap.get(key)));
         }
         return shortcutMap;
@@ -207,13 +201,9 @@
                 onlyCurrentIme);
     }
 
-    public List<InputMethodInfoCompatWrapper> getEnabledInputMethodList() {
+    public List<InputMethodInfo> getEnabledInputMethodList() {
         if (mImm == null) return null;
-        List<InputMethodInfoCompatWrapper> imis = new ArrayList<InputMethodInfoCompatWrapper>();
-        for (InputMethodInfo imi : mImm.getEnabledInputMethodList()) {
-            imis.add(new InputMethodInfoCompatWrapper(imi));
-        }
-        return imis;
+        return mImm.getEnabledInputMethodList();
     }
 
     public void showInputMethodPicker() {
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
index de2e8be..5cdee14 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
@@ -29,14 +29,13 @@
 import android.os.IBinder;
 import android.text.TextUtils;
 import android.util.Log;
+import android.view.inputmethod.InputMethodInfo;
 
-import com.android.inputmethod.compat.InputMethodInfoCompatWrapper;
 import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
 import com.android.inputmethod.compat.InputMethodSubtypeCompatWrapper;
 import com.android.inputmethod.keyboard.KeyboardSwitcher;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -47,7 +46,6 @@
 
     public static final String KEYBOARD_MODE = "keyboard";
     private static final char LOCALE_SEPARATOR = '_';
-    private static final String VOICE_MODE = "voice";
     private static final String SUBTYPE_EXTRAVALUE_REQUIRE_NETWORK_CONNECTIVITY =
             "requireNetworkConnectivity";
 
@@ -68,7 +66,7 @@
     // Variants which should be changed only by reload functions.
     private boolean mNeedsToDisplayLanguage;
     private boolean mIsSystemLanguageSameAsInputLanguage;
-    private InputMethodInfoCompatWrapper mShortcutInputMethodInfo;
+    private InputMethodInfo mShortcutInputMethodInfo;
     private InputMethodSubtypeCompatWrapper mShortcutSubtype;
     private List<InputMethodSubtypeCompatWrapper> mAllEnabledSubtypesOfCurrentInputMethod;
     private InputMethodSubtypeCompatWrapper mCurrentSubtype;
@@ -168,11 +166,11 @@
                             + ", " + mShortcutSubtype.getMode())));
         }
         // TODO: Update an icon for shortcut IME
-        final Map<InputMethodInfoCompatWrapper, List<InputMethodSubtypeCompatWrapper>> shortcuts =
+        final Map<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>> shortcuts =
                 mImm.getShortcutInputMethodsAndSubtypes();
         mShortcutInputMethodInfo = null;
         mShortcutSubtype = null;
-        for (InputMethodInfoCompatWrapper imi : shortcuts.keySet()) {
+        for (InputMethodInfo imi : shortcuts.keySet()) {
             List<InputMethodSubtypeCompatWrapper> subtypes = shortcuts.get(imi);
             // TODO: Returns the first found IMI for now. Should handle all shortcuts as
             // appropriate.
@@ -320,8 +318,7 @@
         return getSubtypeIcon(mShortcutInputMethodInfo, mShortcutSubtype);
     }
 
-    private Drawable getSubtypeIcon(
-            InputMethodInfoCompatWrapper imi, InputMethodSubtypeCompatWrapper subtype) {
+    private Drawable getSubtypeIcon(InputMethodInfo imi, InputMethodSubtypeCompatWrapper subtype) {
         final PackageManager pm = mService.getPackageManager();
         if (imi != null) {
             final String imiPackageName = imi.getPackageName();
diff --git a/java/src/com/android/inputmethod/latin/SubtypeUtils.java b/java/src/com/android/inputmethod/latin/SubtypeUtils.java
index cb2bcf4..8beb71b 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeUtils.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeUtils.java
@@ -17,8 +17,8 @@
 package com.android.inputmethod.latin;
 
 import android.content.Context;
+import android.view.inputmethod.InputMethodInfo;
 
-import com.android.inputmethod.compat.InputMethodInfoCompatWrapper;
 import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
 import com.android.inputmethod.compat.InputMethodSubtypeCompatWrapper;
 
@@ -36,7 +36,7 @@
         final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance();
         if (imm == null) return false;
 
-        final InputMethodInfoCompatWrapper myImi = getInputMethodInfo(context.getPackageName());
+        final InputMethodInfo myImi = getInputMethodInfo(context.getPackageName());
         final List<InputMethodSubtypeCompatWrapper> subtypes =
                 imm.getEnabledInputMethodSubtypeList(myImi, true);
         for (final InputMethodSubtypeCompatWrapper subtype : subtypes) {
@@ -52,26 +52,26 @@
         final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance();
         if (imm == null) return false;
 
-        final List<InputMethodInfoCompatWrapper> enabledImis = imm.getEnabledInputMethodList();
+        final List<InputMethodInfo> enabledImis = imm.getEnabledInputMethodList();
         return hasMultipleEnabledSubtypes(shouldIncludeAuxiliarySubtypes, enabledImis);
     }
 
     public static boolean hasMultipleEnabledSubtypesInThisIme(Context context,
             final boolean shouldIncludeAuxiliarySubtypes) {
-        final InputMethodInfoCompatWrapper myImi = getInputMethodInfo(context.getPackageName());
-        final List<InputMethodInfoCompatWrapper> imiList = Collections.singletonList(myImi);
+        final InputMethodInfo myImi = getInputMethodInfo(context.getPackageName());
+        final List<InputMethodInfo> imiList = Collections.singletonList(myImi);
         return hasMultipleEnabledSubtypes(shouldIncludeAuxiliarySubtypes, imiList);
     }
 
     private static boolean hasMultipleEnabledSubtypes(final boolean shouldIncludeAuxiliarySubtypes,
-            List<InputMethodInfoCompatWrapper> imiList) {
+            List<InputMethodInfo> imiList) {
         final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance();
         if (imm == null) return false;
 
         // Number of the filtered IMEs
         int filteredImisCount = 0;
 
-        for (InputMethodInfoCompatWrapper imi : imiList) {
+        for (InputMethodInfo imi : imiList) {
             // We can return true immediately after we find two or more filtered IMEs.
             if (filteredImisCount > 1) return true;
             final List<InputMethodSubtypeCompatWrapper> subtypes =
@@ -120,13 +120,13 @@
         return getInputMethodInfo(packageName).getId();
     }
 
-    public static InputMethodInfoCompatWrapper getInputMethodInfo(String packageName) {
+    public static InputMethodInfo getInputMethodInfo(String packageName) {
         final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance();
         if (imm == null) {
             throw new RuntimeException("Input method manager not found");
         }
 
-        for (final InputMethodInfoCompatWrapper imi : imm.getEnabledInputMethodList()) {
+        for (final InputMethodInfo imi : imm.getEnabledInputMethodList()) {
             if (imi.getPackageName().equals(packageName))
                 return imi;
         }
