diff --git a/java/src/com/android/inputmethod/latin/InputLanguageSelection.java b/java/src/com/android/inputmethod/latin/InputLanguageSelection.java
index a9f2c2c22df54edfeda8c8ec5f33a2adc8f37b5d..5587c685fa61847f660fe0dabd2ec40905a0de36 100644
--- a/java/src/com/android/inputmethod/latin/InputLanguageSelection.java
+++ b/java/src/com/android/inputmethod/latin/InputLanguageSelection.java
@@ -106,7 +106,7 @@ public class InputLanguageSelection extends PreferenceActivity {
         conf.locale = locale;
         res.updateConfiguration(conf, res.getDisplayMetrics());
 
-        int mainDicResId = LatinIME.getMainDictionaryResourceId(res);
+        int mainDicResId = Utils.getMainDictionaryResourceId(res);
         BinaryDictionary bd = BinaryDictionary.initDictionary(this, mainDicResId, Suggest.DIC_MAIN);
 
         // Is the dictionary larger than a placeholder? Arbitrarily chose a lower limit of
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 38ee8262696127ceabee85c540ef4549448b6039..40cebb3952549872ebb7357cf1f5df6434a34d19 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -81,11 +81,27 @@ import java.util.Locale;
  * Input method implementation for Qwerty'ish keyboard.
  */
 public class LatinIME extends InputMethodService implements KeyboardActionListener {
-    private static final String TAG = "LatinIME";
+    private static final String TAG = LatinIME.class.getSimpleName();
     private static final boolean PERF_DEBUG = false;
     private static final boolean TRACE = false;
     private static boolean DEBUG = LatinImeLogger.sDBG;
 
+    /**
+     * The private IME option used to indicate that no microphone should be
+     * shown for a given text field. For instance, this is specified by the
+     * search dialog when the dialog is already showing a voice search button.
+     *
+     * @deprecated Use {@link LatinIME#IME_OPTION_NO_MICROPHONE} with package name prefixed.
+     */
+    public static final String IME_OPTION_NO_MICROPHONE_COMPAT = "nm";
+
+    /**
+     * The private IME option used to indicate that no microphone should be
+     * shown for a given text field. For instance, this is specified by the
+     * search dialog when the dialog is already showing a voice search button.
+     */
+    public static final String IME_OPTION_NO_MICROPHONE = "noMicrophone";
+
     private static final int DELAY_UPDATE_SUGGESTIONS = 180;
     private static final int DELAY_UPDATE_OLD_SUGGESTIONS = 300;
     private static final int DELAY_UPDATE_SHIFT_STATE = 300;
@@ -345,7 +361,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
         super.onCreate();
 
         mImm = ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE));
-        mInputMethodId = Utils.getInputMethodId(mImm, getApplicationInfo().packageName);
+        mInputMethodId = Utils.getInputMethodId(mImm, getPackageName());
         mSubtypeSwitcher = SubtypeSwitcher.getInstance();
         mKeyboardSwitcher = KeyboardSwitcher.getInstance();
 
@@ -394,16 +410,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
         mVoiceConnector = VoiceIMEConnector.init(this, prefs, mHandler);
     }
 
-    /**
-     * Returns a main dictionary resource id
-     * @return main dictionary resource id
-     */
-    public static int getMainDictionaryResourceId(Resources res) {
-        final String MAIN_DIC_NAME = "main";
-        String packageName = LatinIME.class.getPackage().getName();
-        return res.getIdentifier(MAIN_DIC_NAME, "raw", packageName);
-    }
-
     private void initSuggest() {
         updateAutoTextEnabled();
         String locale = mSubtypeSwitcher.getInputLocaleStr();
@@ -416,7 +422,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
         mQuickFixes = isQuickFixesEnabled(prefs);
 
         final Resources res = mResources;
-        int mainDicResId = getMainDictionaryResourceId(res);
+        int mainDicResId = Utils.getMainDictionaryResourceId(res);
         mSuggest = new Suggest(this, mainDicResId);
         loadAndSetAutoCorrectionThreshold(prefs);
 
diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java
index b4c05134f36a5f667c192126f863d758ca26b655..f26766768acd6349bdcff7cc57bd0dc996803fd6 100644
--- a/java/src/com/android/inputmethod/latin/Utils.java
+++ b/java/src/com/android/inputmethod/latin/Utils.java
@@ -18,6 +18,7 @@ package com.android.inputmethod.latin;
 
 import com.android.inputmethod.keyboard.KeyboardId;
 
+import android.content.res.Resources;
 import android.inputmethodservice.InputMethodService;
 import android.os.AsyncTask;
 import android.os.Handler;
@@ -526,4 +527,30 @@ public class Utils {
         return variation
                 == (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
     }
+
+    public static boolean containsInCsv(String key, String csv) {
+        if (csv == null)
+            return false;
+        for (String option : csv.split(",")) {
+            if (option.equals(key))
+                return true;
+        }
+        return false;
+    }
+
+    public static boolean inPrivateImeOptions(String packageName, String key,
+            EditorInfo attribute) {
+        if (attribute == null)
+            return false;
+        return containsInCsv(packageName != null ? packageName + "." + key : key,
+                attribute.privateImeOptions);
+    }
+
+    /**
+     * Returns a main dictionary resource id
+     * @return main dictionary resource id
+     */
+    public static int getMainDictionaryResourceId(Resources res) {
+        return res.getIdentifier("main", "raw", LatinIME.class.getPackage().getName());
+    }
 }
diff --git a/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java b/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java
index 277ef7e65a85eac6b25dda4bcb1f4c3976da75f9..105656fe02a3be401935100399c23883778295de 100644
--- a/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java
+++ b/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java
@@ -25,6 +25,7 @@ import com.android.inputmethod.latin.R;
 import com.android.inputmethod.latin.SharedPreferencesCompat;
 import com.android.inputmethod.latin.SubtypeSwitcher;
 import com.android.inputmethod.latin.SuggestedWords;
+import com.android.inputmethod.latin.Utils;
 
 import android.app.AlertDialog;
 import android.content.Context;
@@ -74,10 +75,6 @@ public class VoiceIMEConnector implements VoiceInput.UiListener {
     // For example, the user has a Chinese UI but activates voice input.
     private static final String PREF_HAS_USED_VOICE_INPUT_UNSUPPORTED_LOCALE =
             "has_used_voice_input_unsupported_locale";
-    // The private IME option used to indicate that no microphone should be shown for a
-    // given text field. For instance this is specified by the search dialog when the
-    // dialog is already showing a voice search button.
-    private static final String IME_OPTION_NO_MICROPHONE = "nm";
     private static final int RECOGNITIONVIEW_HEIGHT_THRESHOLD_RATIO = 6;
 
     private static final String TAG = VoiceIMEConnector.class.getSimpleName();
@@ -627,9 +624,11 @@ public class VoiceIMEConnector implements VoiceInput.UiListener {
     }
 
     private boolean shouldShowVoiceButton(FieldContext fieldContext, EditorInfo attribute) {
-        return ENABLE_VOICE_BUTTON && fieldCanDoVoice(fieldContext)
-                && !(attribute != null
-                        && IME_OPTION_NO_MICROPHONE.equals(attribute.privateImeOptions))
+        final boolean noMic = Utils.inPrivateImeOptions(null,
+                LatinIME.IME_OPTION_NO_MICROPHONE_COMPAT, attribute)
+                || Utils.inPrivateImeOptions(mService.getPackageName(),
+                        LatinIME.IME_OPTION_NO_MICROPHONE, attribute);
+        return ENABLE_VOICE_BUTTON && fieldCanDoVoice(fieldContext) && !noMic
                 && SpeechRecognizer.isRecognitionAvailable(mService);
     }