diff --git a/java/res/xml-xlarge/kbd_number.xml b/java/res/xml-xlarge/kbd_number.xml
index 93bc1363abb5ba05b4a47b02ca1ba41ba0271a31..c2cbb31c45ee359ac4cdd2f595c92ce046352697 100644
--- a/java/res/xml-xlarge/kbd_number.xml
+++ b/java/res/xml-xlarge/kbd_number.xml
@@ -132,9 +132,15 @@
             latin:keyLabel="0" />
         <Key
             latin:keyLabel="#" />
-        <Key
-            latin:keyStyle="micKeyStyle"
-            latin:keyWidth="8.042%p" />
+        <switch>
+            <case
+                latin:voiceKeyEnabled="true"
+            >
+                <Key
+                    latin:keyStyle="micKeyStyle"
+                    latin:keyWidth="8.042%p" />
+            </case>
+        </switch>
         <!-- There is an empty area bellow the "Enter" key and right of the "#" key.  To ignore
              the touch event on the area, "#" is intentionally not marked as a right edge key. -->
     </Row>
diff --git a/java/res/xml-xlarge/kbd_phone.xml b/java/res/xml-xlarge/kbd_phone.xml
index 45c298362494681df0f6335a365a45a56d02c5c2..c320ebbbcbef69386f93e331eb46ddf34d7aa87c 100644
--- a/java/res/xml-xlarge/kbd_phone.xml
+++ b/java/res/xml-xlarge/kbd_phone.xml
@@ -140,9 +140,15 @@
             latin:keyStyle="num0KeyStyle" />
         <Key
             latin:keyStyle="numPoundKeyStyle" />
-        <Key
-            latin:keyStyle="micKeyStyle"
-            latin:keyWidth="8.042%p" />
+        <switch>
+            <case
+                latin:voiceKeyEnabled="true"
+            >
+                <Key
+                    latin:keyStyle="micKeyStyle"
+                    latin:keyWidth="8.042%p" />
+            </case>
+        </switch>
         <!-- There is an empty area bellow the "Enter" key and right of the "#" key.  To ignore
              the touch event on the area, "#" is intentionally not marked as a right edge key. -->
     </Row>
diff --git a/java/res/xml-xlarge/kbd_phone_symbols.xml b/java/res/xml-xlarge/kbd_phone_symbols.xml
index 891ceacbe67271694f73aaffe6cbbeff81a49a53..da15b5ad0dda2ed88007ff6e4074ea3d5f838675 100644
--- a/java/res/xml-xlarge/kbd_phone_symbols.xml
+++ b/java/res/xml-xlarge/kbd_phone_symbols.xml
@@ -152,9 +152,15 @@
             latin:keyStyle="num0KeyStyle" />
         <Key
             latin:keyStyle="numPoundKeyStyle" />
-        <Key
-            latin:keyStyle="micKeyStyle"
-            latin:keyWidth="8.042%p" />
+        <switch>
+            <case
+                latin:voiceKeyEnabled="true"
+            >
+                <Key
+                    latin:keyStyle="micKeyStyle"
+                    latin:keyWidth="8.042%p" />
+            </case>
+        </switch>
         <!-- There is an empty area bellow the "Enter" key and right of the "#" key.  To ignore
              the touch event on the area, "#" is intentionally not marked as a right edge key. -->
     </Row>
diff --git a/java/res/xml-xlarge/kbd_qwerty_row4.xml b/java/res/xml-xlarge/kbd_qwerty_row4.xml
index e222a6bb00783965b13dd5fcd0f5891e149ea64e..98acfc1626f1ad9fb3c0ff9782112fe4601dc0cc 100644
--- a/java/res/xml-xlarge/kbd_qwerty_row4.xml
+++ b/java/res/xml-xlarge/kbd_qwerty_row4.xml
@@ -114,7 +114,13 @@
                     latin:popupCharacters="_" />
             </default>
         </switch>
-        <Key
-            latin:keyStyle="micKeyStyle" />
+        <switch>
+            <case
+                latin:voiceKeyEnabled="true"
+            >
+                <Key
+                    latin:keyStyle="micKeyStyle" />
+            </case>
+        </switch>
     </Row>
 </merge>
diff --git a/java/res/xml-xlarge/kbd_symbols.xml b/java/res/xml-xlarge/kbd_symbols.xml
index 50b8e5307db01c2417259a3b7755558b38c99a0f..d804f7909f181ec3647d6afcd0fa400aa3957560 100644
--- a/java/res/xml-xlarge/kbd_symbols.xml
+++ b/java/res/xml-xlarge/kbd_symbols.xml
@@ -162,7 +162,13 @@
             latin:popupCharacters="“,”,«,»,˝" />
         <Key
             latin:keyLabel="_" />
-        <Key
-            latin:keyStyle="micKeyStyle" />
+        <switch>
+            <case
+                latin:voiceKeyEnabled="true"
+            >
+                <Key
+                    latin:keyStyle="micKeyStyle" />
+            </case>
+        </switch>
     </Row>
 </Keyboard>
diff --git a/java/res/xml-xlarge/kbd_symbols_shift.xml b/java/res/xml-xlarge/kbd_symbols_shift.xml
index f586b1a288669118f80eaf787dcb00bb5c4c8ca8..db33aaacab6a10fd209b57c10a066c78a01d4fa9 100644
--- a/java/res/xml-xlarge/kbd_symbols_shift.xml
+++ b/java/res/xml-xlarge/kbd_symbols_shift.xml
@@ -139,7 +139,13 @@
         <Key
             latin:keyStyle="spaceKeyStyle"
             latin:keyWidth="37.454%p" />
-        <Key
-            latin:keyStyle="micKeyStyle" />
+        <switch>
+            <case
+                latin:voiceKeyEnabled="true"
+            >
+                <Key
+                    latin:keyStyle="micKeyStyle" />
+            </case>
+        </switch>
     </Row>
 </Keyboard>
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index addc6c782b60852c4888aa943c74204db635becb..5e701c1f066c0d2c79bdfbf575e10812fdfbe93d 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -25,9 +25,6 @@ import com.android.inputmethod.keyboard.LatinKeyboardView;
 import com.android.inputmethod.latin.Utils.RingCharBuffer;
 import com.android.inputmethod.voice.VoiceIMEConnector;
 
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
 import android.app.AlertDialog;
 import android.content.BroadcastReceiver;
 import android.content.Context;
@@ -37,7 +34,6 @@ import android.content.IntentFilter;
 import android.content.SharedPreferences;
 import android.content.res.Configuration;
 import android.content.res.Resources;
-import android.content.res.XmlResourceParser;
 import android.inputmethodservice.InputMethodService;
 import android.media.AudioManager;
 import android.os.Debug;
@@ -74,7 +70,6 @@ import android.widget.HorizontalScrollView;
 import android.widget.LinearLayout;
 
 import java.io.FileDescriptor;
-import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Arrays;