Merge "Workaround return preserved backing view height when the backing view is not ready" into jb-dev
diff --git a/java/res/values-ms/strings.xml b/java/res/values-ms/strings.xml
index 4ba3159..2d6872e 100644
--- a/java/res/values-ms/strings.xml
+++ b/java/res/values-ms/strings.xml
@@ -120,16 +120,11 @@
     <string name="subtype_en_US" msgid="6160452336634534239">"Bahasa Inggeris (AS)"</string>
     <string name="subtype_no_language" msgid="141420857808801746">"Tiada bahasa"</string>
     <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Tiada bahasa (QWERTY)"</string>
-    <!-- no translation found for subtype_no_language_qwertz (1177848172397202890) -->
-    <skip />
-    <!-- no translation found for subtype_no_language_azerty (8721460968141187394) -->
-    <skip />
-    <!-- no translation found for subtype_no_language_dvorak (3122976737669823935) -->
-    <skip />
-    <!-- no translation found for subtype_no_language_colemak (4205992994906097244) -->
-    <skip />
-    <!-- no translation found for subtype_no_language_pcqwerty (8840928374394180189) -->
-    <skip />
+    <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Tiada bahasa (QWERTZ)"</string>
+    <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Tiada bahasa (AZERTY)"</string>
+    <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Tiada bahasa (Dvorak)"</string>
+    <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Tiada bahasa (Colemak)"</string>
+    <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Tiada bahasa (PC)"</string>
     <string name="custom_input_styles_title" msgid="8429952441821251512">"Gaya input peribadi"</string>
     <string name="add_style" msgid="6163126614514489951">"Tambah gaya"</string>
     <string name="add" msgid="8299699805688017798">"Tambah"</string>
diff --git a/java/res/values-sw600dp-land/dimens.xml b/java/res/values-sw600dp-land/dimens.xml
index 8a59c9b..a478df8 100644
--- a/java/res/values-sw600dp-land/dimens.xml
+++ b/java/res/values-sw600dp-land/dimens.xml
@@ -35,7 +35,8 @@
     <fraction name="key_bottom_gap_gb">5.200%p</fraction>
     <fraction name="key_horizontal_gap_gb">1.447%p</fraction>
 
-    <fraction name="key_bottom_gap_ics">4.0%p</fraction>
+    <fraction name="key_bottom_gap_ics">4.5%p</fraction>
+    <fraction name="key_horizontal_gap_ics">0.9%p</fraction>
     <fraction name="keyboard_bottom_padding_ics">0.0%p</fraction>
 
     <dimen name="popup_key_height">81.9dp</dimen>
@@ -43,13 +44,14 @@
     <!-- left or right padding of label alignment -->
     <dimen name="key_label_horizontal_padding">18dp</dimen>
 
-    <fraction name="key_letter_ratio">45%</fraction>
+    <fraction name="key_letter_ratio">50%</fraction>
     <fraction name="key_large_letter_ratio">48%</fraction>
     <fraction name="key_label_ratio">32%</fraction>
     <fraction name="key_hint_letter_ratio">23%</fraction>
     <fraction name="key_hint_label_ratio">34%</fraction>
     <fraction name="key_uppercase_letter_ratio">29%</fraction>
-    <fraction name="spacebar_text_ratio">33.33%</fraction>
+    <fraction name="spacebar_text_ratio">30.0%</fraction>
+    <dimen name="key_uppercase_letter_padding">4dp</dimen>
 
     <dimen name="suggestions_strip_padding">252.0dp</dimen>
     <integer name="max_more_suggestions_row">5</integer>
diff --git a/java/res/values-sw600dp/dimens.xml b/java/res/values-sw600dp/dimens.xml
index cb2a861..8ecdffb 100644
--- a/java/res/values-sw600dp/dimens.xml
+++ b/java/res/values-sw600dp/dimens.xml
@@ -38,8 +38,9 @@
     <fraction name="key_bottom_gap_gb">4.625%p</fraction>
     <fraction name="key_horizontal_gap_gb">2.113%p</fraction>
 
-    <fraction name="key_bottom_gap_ics">4.0%p</fraction>
-    <fraction name="keyboard_bottom_padding_ics">0.0%p</fraction>
+    <fraction name="key_bottom_gap_ics">4.5%p</fraction>
+    <fraction name="key_horizontal_gap_ics">1.565%p</fraction>
+    <fraction name="keyboard_bottom_padding_ics">4.0%p</fraction>
 
     <dimen name="more_keys_keyboard_key_horizontal_padding">6dp</dimen>
     <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
@@ -58,9 +59,9 @@
     <fraction name="key_label_ratio">25%</fraction>
     <fraction name="key_hint_letter_ratio">23%</fraction>
     <fraction name="key_hint_label_ratio">28%</fraction>
-    <fraction name="key_uppercase_letter_ratio">26%</fraction>
+    <fraction name="key_uppercase_letter_ratio">22%</fraction>
     <fraction name="key_preview_text_ratio">50%</fraction>
-    <fraction name="spacebar_text_ratio">32.14%</fraction>
+    <fraction name="spacebar_text_ratio">28.0%</fraction>
     <dimen name="key_preview_height">94.5dp</dimen>
     <dimen name="key_preview_offset">16.0dp</dimen>
 
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index e14633a..dbe3cd7 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -68,7 +68,7 @@
         <attr name="keyHintLetterPadding" format="dimension" />
         <!-- Bottom padding of popup hint letter "..." to the edge of the key.-->
         <attr name="keyPopupHintLetterPadding" format="dimension" />
-        <!-- Top and right padding of shifted letter hint to the edge of the key.-->
+        <!-- Right padding of shifted letter hint to the edge of the key.-->
         <attr name="keyShiftedLetterHintPadding" format="dimension" />
 
         <!-- Color to use for the label in a key. -->
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index e258f3b..69fdea7 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -248,23 +248,23 @@
     <!-- Title of the item to change the keyboard theme [CHAR LIMIT=20]-->
     <string name="keyboard_layout">Keyboard theme</string>
 
-    <!-- Description for English (United Kingdom) keyboard subtype [CHAR LIMIT=22] -->
+    <!-- Description for English (United Kingdom) keyboard subtype [CHAR LIMIT=25] -->
     <string name="subtype_en_GB">English (UK)</string>
-    <!-- Description for English (United States) keyboard subtype [CHAR LIMIT=22] -->
+    <!-- Description for English (United States) keyboard subtype [CHAR LIMIT=25] -->
     <string name="subtype_en_US">English (US)</string>
-    <!-- Description for language agnostic keyboard subtype [CHAR LIMIT=22] -->
+    <!-- Description for language agnostic keyboard subtype [CHAR LIMIT=25] -->
     <string name="subtype_no_language">No language</string>
-    <!-- Description for language agnostic QWERTY keyboard subtype [CHAR LIMIT=22] -->
+    <!-- Description for language agnostic QWERTY keyboard subtype [CHAR LIMIT=25] -->
     <string name="subtype_no_language_qwerty">No language (QWERTY)</string>
-    <!-- Description for language agnostic QWERTZ keyboard subtype [CHAR LIMIT=22] -->
+    <!-- Description for language agnostic QWERTZ keyboard subtype [CHAR LIMIT=25] -->
     <string name="subtype_no_language_qwertz">No language (QWERTZ)</string>
-    <!-- Description for language agnostic AZERTY keyboard subtype [CHAR LIMIT=22] -->
+    <!-- Description for language agnostic AZERTY keyboard subtype [CHAR LIMIT=25] -->
     <string name="subtype_no_language_azerty">No language (AZERTY)</string>
-    <!-- Description for language agnostic Dvorak keyboard subtype [CHAR LIMIT=22] -->
+    <!-- Description for language agnostic Dvorak keyboard subtype [CHAR LIMIT=25] -->
     <string name="subtype_no_language_dvorak">No language (Dvorak)</string>
-    <!-- Description for language agnostic Colemak keyboard subtype [CHAR LIMIT=22] -->
+    <!-- Description for language agnostic Colemak keyboard subtype [CHAR LIMIT=25] -->
     <string name="subtype_no_language_colemak">No language (Colemak)</string>
-    <!-- Description for language agnostic PC QWERTY keyboard subtype [CHAR LIMIT=22] -->
+    <!-- Description for language agnostic PC QWERTY keyboard subtype [CHAR LIMIT=25] -->
     <string name="subtype_no_language_pcqwerty">No language (PC)</string>
 
     <!-- Title of the preference settings for custom input styles (language and keyboard layout pairs) [CHAR LIMIT=35]-->
diff --git a/java/res/xml-sw600dp/key_f1.xml b/java/res/xml-sw600dp/key_f1.xml
deleted file mode 100644
index faf0875..0000000
--- a/java/res/xml-sw600dp/key_f1.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, 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.
-*/
--->
-
-<merge
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
->
-    <switch>
-        <case
-            latin:mode="email|url"
-        >
-            <Key
-                latin:keyStyle="comKeyStyle" />
-        </case>
-        <default>
-            <Key
-                latin:keyLabel="/"
-                latin:keyHintLabel="\@"
-                latin:moreKeys="\@"
-                latin:keyStyle="hasShiftedLetterHintStyle" />
-        </default>
-    </switch>
-</merge>
diff --git a/java/res/xml-sw600dp/key_smiley.xml b/java/res/xml-sw600dp/key_smiley.xml
deleted file mode 100644
index 3430d78..0000000
--- a/java/res/xml-sw600dp/key_smiley.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 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.
-*/
--->
-
-<merge
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
->
-    <switch>
-        <case
-            latin:mode="email"
-        >
-            <Key
-                latin:keyLabel="\@" />
-        </case>
-        <case
-            latin:mode="url"
-        >
-            <Key
-                latin:keyLabel="-"
-                latin:keyHintLabel="_"
-                latin:moreKeys="_"
-                latin:keyStyle="hasShiftedLetterHintStyle" />
-        </case>
-        <case
-            latin:imeAction="actionSearch"
-        >
-            <Key
-                latin:keyLabel=":"
-                latin:keyHintLabel="+"
-                latin:moreKeys="+"
-                latin:keyStyle="hasShiftedLetterHintStyle" />
-        </case>
-        <default>
-            <Key
-                latin:keyStyle="smileyKeyStyle" />
-        </default>
-    </switch>
-</merge>
diff --git a/java/res/xml-sw600dp/key_styles_common.xml b/java/res/xml-sw600dp/key_styles_common.xml
index 884cea1..9f16d1b 100644
--- a/java/res/xml-sw600dp/key_styles_common.xml
+++ b/java/res/xml-sw600dp/key_styles_common.xml
@@ -161,7 +161,7 @@
     <key-style
         latin:styleName="comKeyStyle"
         latin:keyLabel="!text/keylabel_for_popular_domain"
-        latin:keyLabelFlags="fontNormal|hasPopupHint|preserveCase"
+        latin:keyLabelFlags="autoXScale|fontNormal|hasPopupHint|preserveCase"
         latin:keyOutputText="!text/keylabel_for_popular_domain"
         latin:moreKeys="!text/more_keys_for_popular_domain" />
 </merge>
diff --git a/java/res/xml-sw600dp/keys_f1f2.xml b/java/res/xml-sw600dp/keys_f1f2.xml
new file mode 100644
index 0000000..14b7231
--- /dev/null
+++ b/java/res/xml-sw600dp/keys_f1f2.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <switch>
+        <case
+            latin:mode="url"
+        >
+            <Key
+                latin:keyStyle="comKeyStyle"
+                latin:keyWidth="17.8%p" />
+        </case>
+        <default>
+            <switch>
+                <case
+                    latin:mode="email"
+                >
+                    <Key
+                        latin:keyStyle="comKeyStyle" />
+                </case>
+                <case
+                    latin:imeAction="actionSearch"
+                >
+                    <Key
+                        latin:keyLabel=":"
+                        latin:keyHintLabel="+"
+                        latin:moreKeys="+"
+                        latin:keyStyle="hasShiftedLetterHintStyle" />
+                </case>
+                <default>
+                    <Key
+                        latin:keyStyle="smileyKeyStyle" />
+                </default>
+            </switch>
+            <switch>
+                <case
+                    latin:mode="email"
+                >
+                    <Key
+                        latin:keyLabel="\@" />
+                </case>
+                <default>
+                    <Key
+                        latin:keyLabel="/"
+                        latin:keyHintLabel="\@"
+                        latin:moreKeys="\@"
+                        latin:keyStyle="hasShiftedLetterHintStyle" />
+                </default>
+            </switch>
+        </default>
+    </switch>
+</merge>
diff --git a/java/res/xml-sw600dp/row_dvorak4.xml b/java/res/xml-sw600dp/row_dvorak4.xml
index 14a5fd8..63ab8a8 100644
--- a/java/res/xml-sw600dp/row_dvorak4.xml
+++ b/java/res/xml-sw600dp/row_dvorak4.xml
@@ -27,10 +27,8 @@
         <Key
             latin:keyStyle="toSymbolKeyStyle"
             latin:keyWidth="13.0%p" />
-        <Key
-            latin:keyStyle="tabKeyStyle" />
         <include
-            latin:keyboardLayout="@xml/key_f1" />
+            latin:keyboardLayout="@xml/keys_f1f2" />
         <include
             latin:keyXPos="30.750%p"
             latin:keyboardLayout="@xml/key_space" />
diff --git a/java/res/xml-sw600dp/row_hebrew4.xml b/java/res/xml-sw600dp/row_hebrew4.xml
index 536b653..3d50c75 100644
--- a/java/res/xml-sw600dp/row_hebrew4.xml
+++ b/java/res/xml-sw600dp/row_hebrew4.xml
@@ -27,10 +27,8 @@
         <Key
             latin:keyStyle="toSymbolKeyStyle"
             latin:keyWidth="13.0%p" />
-        <Key
-            latin:keyStyle="tabKeyStyle" />
         <include
-            latin:keyboardLayout="@xml/key_f1" />
+            latin:keyboardLayout="@xml/keys_f1f2" />
         <include
             latin:keyboardLayout="@xml/key_space" />
         <include
diff --git a/java/res/xml-sw600dp/row_pcqwerty5.xml b/java/res/xml-sw600dp/row_pcqwerty5.xml
index 83bc83e..e9e231a 100644
--- a/java/res/xml-sw600dp/row_pcqwerty5.xml
+++ b/java/res/xml-sw600dp/row_pcqwerty5.xml
@@ -33,7 +33,7 @@
                     latin:keyWidth="10.5%p" />
             </case>
             <case
-                latin:mode="email|url"
+                latin:mode="url"
             >
                 <Key
                     latin:keyStyle="comKeyStyle"
@@ -41,9 +41,9 @@
                     latin:keyWidth="10.5%p" />
             </case>
             <default>
-                <Spacer
-                    latin:keyXPos="15.0%p"
-                    latin:keyWidth="10.5%p" />
+                <include
+                    latin:keyboardLayout="@xml/keys_f1f2"
+                    latin:keyXPos="18.5%p" />
             </default>
         </switch>
         <switch>
diff --git a/java/res/xml-sw600dp/row_qwerty4.xml b/java/res/xml-sw600dp/row_qwerty4.xml
index 76ac3a0..a41dc64 100644
--- a/java/res/xml-sw600dp/row_qwerty4.xml
+++ b/java/res/xml-sw600dp/row_qwerty4.xml
@@ -27,10 +27,8 @@
         <Key
             latin:keyStyle="toSymbolKeyStyle"
             latin:keyWidth="13.0%p" />
-        <Key
-            latin:keyStyle="tabKeyStyle" />
         <include
-            latin:keyboardLayout="@xml/key_f1" />
+            latin:keyboardLayout="@xml/keys_f1f2" />
         <include
             latin:keyXPos="30.750%p"
             latin:keyboardLayout="@xml/key_space" />
diff --git a/java/res/xml-sw600dp/row_symbols4.xml b/java/res/xml-sw600dp/row_symbols4.xml
index d294e20..4c0ad23 100644
--- a/java/res/xml-sw600dp/row_symbols4.xml
+++ b/java/res/xml-sw600dp/row_symbols4.xml
@@ -28,7 +28,7 @@
             latin:keyStyle="toAlphaKeyStyle"
             latin:keyWidth="13.0%p" />
         <Key
-            latin:keyStyle="tabKeyStyle" />
+            latin:keyStyle="smileyKeyStyle" />
         <Key
             latin:keyLabel="\@" />
         <include
diff --git a/java/res/xml-sw600dp/row_symbols_shift4.xml b/java/res/xml-sw600dp/row_symbols_shift4.xml
index 3a78c72..23db193 100644
--- a/java/res/xml-sw600dp/row_symbols_shift4.xml
+++ b/java/res/xml-sw600dp/row_symbols_shift4.xml
@@ -28,7 +28,7 @@
             latin:keyStyle="toAlphaKeyStyle"
             latin:keyWidth="13.0%p" />
         <Key
-            latin:keyStyle="tabKeyStyle" />
+            latin:keyStyle="smileyKeyStyle" />
         <include
             latin:keyXPos="30.750%p"
             latin:keyboardLayout="@xml/key_space" />
diff --git a/java/res/xml-sw600dp/rows_arabic.xml b/java/res/xml-sw600dp/rows_arabic.xml
index 5522326..c796a50 100644
--- a/java/res/xml-sw600dp/rows_arabic.xml
+++ b/java/res/xml-sw600dp/rows_arabic.xml
@@ -46,10 +46,8 @@
         latin:keyWidth="7.6%p"
     >
         <include
-            latin:keyboardLayout="@xml/key_smiley"
-            latin:keyWidth="10.0%p" />
-        <include
-            latin:keyboardLayout="@xml/rowkeys_arabic3" />
+            latin:keyboardLayout="@xml/rowkeys_arabic3"
+            latin:keyXPos="10.0%p" />
     </Row>
     <include
         latin:keyboardLayout="@xml/row_qwerty4" />
diff --git a/java/res/xml-sw600dp/rows_azerty.xml b/java/res/xml-sw600dp/rows_azerty.xml
index 3ec22d3..fbfecb3 100644
--- a/java/res/xml-sw600dp/rows_azerty.xml
+++ b/java/res/xml-sw600dp/rows_azerty.xml
@@ -53,9 +53,9 @@
             latin:keyboardLayout="@xml/rowkeys_azerty3" />
         <include
             latin:keyboardLayout="@xml/keys_comma_period" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
-            latin:keyXPos="-8.5%p"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyXPos="-10.0%p"
             latin:keyWidth="fillRight" />
     </Row>
     <include
diff --git a/java/res/xml-sw600dp/rows_bulgarian.xml b/java/res/xml-sw600dp/rows_bulgarian.xml
index a3b77cc..8c41f96 100644
--- a/java/res/xml-sw600dp/rows_bulgarian.xml
+++ b/java/res/xml-sw600dp/rows_bulgarian.xml
@@ -53,9 +53,9 @@
             latin:keyboardLayout="@xml/rowkeys_bulgarian3" />
         <include
             latin:keyboardLayout="@xml/keys_comma_period" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
-            latin:keyXPos="-9.0%p"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyXPos="-10.0%p"
             latin:keyWidth="fillRight" />
     </Row>
     <include
diff --git a/java/res/xml-sw600dp/rows_colemak.xml b/java/res/xml-sw600dp/rows_colemak.xml
index aada5eb..b34957c 100644
--- a/java/res/xml-sw600dp/rows_colemak.xml
+++ b/java/res/xml-sw600dp/rows_colemak.xml
@@ -55,9 +55,9 @@
             latin:keyboardLayout="@xml/rowkeys_colemak3" />
         <include
             latin:keyboardLayout="@xml/keys_comma_period" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
-            latin:keyXPos="-8.5%p"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyXPos="-10.0%p"
             latin:keyWidth="fillRight" />
     </Row>
     <include
diff --git a/java/res/xml-sw600dp/rows_dvorak.xml b/java/res/xml-sw600dp/rows_dvorak.xml
index aec4a5c..d361c3e 100644
--- a/java/res/xml-sw600dp/rows_dvorak.xml
+++ b/java/res/xml-sw600dp/rows_dvorak.xml
@@ -53,9 +53,9 @@
             latin:keyWidth="10.0%p" />
         <include
             latin:keyboardLayout="@xml/rowkeys_dvorak3" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
-            latin:keyXPos="-8.5%p"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyXPos="-10.0%p"
             latin:keyWidth="fillRight" />
     </Row>
     <include
diff --git a/java/res/xml-sw600dp/rows_east_slavic.xml b/java/res/xml-sw600dp/rows_east_slavic.xml
index 26fd7df..3f8e50d 100644
--- a/java/res/xml-sw600dp/rows_east_slavic.xml
+++ b/java/res/xml-sw600dp/rows_east_slavic.xml
@@ -56,8 +56,8 @@
             latin:keyboardLayout="@xml/rowkeys_east_slavic3" />
         <include
             latin:keyboardLayout="@xml/keys_comma_period" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
             latin:keyXPos="-9.0%p"
             latin:keyWidth="fillRight" />
     </Row>
diff --git a/java/res/xml-sw600dp/rows_farsi.xml b/java/res/xml-sw600dp/rows_farsi.xml
index 7580042..3b39b0a 100644
--- a/java/res/xml-sw600dp/rows_farsi.xml
+++ b/java/res/xml-sw600dp/rows_farsi.xml
@@ -52,9 +52,9 @@
             latin:keyboardLayout="@xml/rowkeys_farsi3" />
         <include
             latin:keyboardLayout="@xml/keys_comma_period" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
-            latin:keyXPos="-9.0%p"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyXPos="-10.0%p"
             latin:keyWidth="fillRight" />
     </Row>
     <include
diff --git a/java/res/xml-sw600dp/rows_georgian.xml b/java/res/xml-sw600dp/rows_georgian.xml
index d4c39af4..2e166bd 100644
--- a/java/res/xml-sw600dp/rows_georgian.xml
+++ b/java/res/xml-sw600dp/rows_georgian.xml
@@ -53,8 +53,8 @@
             latin:keyboardLayout="@xml/rowkeys_georgian3" />
         <include
             latin:keyboardLayout="@xml/keys_comma_period" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
             latin:keyXPos="-9.0%p"
             latin:keyWidth="fillRight" />
     </Row>
diff --git a/java/res/xml-sw600dp/rows_greek.xml b/java/res/xml-sw600dp/rows_greek.xml
index 8314222..85d5c8a 100644
--- a/java/res/xml-sw600dp/rows_greek.xml
+++ b/java/res/xml-sw600dp/rows_greek.xml
@@ -55,8 +55,8 @@
             latin:keyboardLayout="@xml/rowkeys_greek3" />
         <include
             latin:keyboardLayout="@xml/keys_comma_period" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
             latin:keyXPos="-9.0%p"
             latin:keyWidth="fillRight" />
     </Row>
diff --git a/java/res/xml-sw600dp/rows_hebrew.xml b/java/res/xml-sw600dp/rows_hebrew.xml
index 521473f..55ce69a 100644
--- a/java/res/xml-sw600dp/rows_hebrew.xml
+++ b/java/res/xml-sw600dp/rows_hebrew.xml
@@ -52,10 +52,6 @@
         <include
             latin:keyboardLayout="@xml/rowkeys_hebrew3"
             latin:keyXPos="10.0%p" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
-            latin:keyXPos="-8.5%p"
-            latin:keyWidth="fillRight" />
     </Row>
     <include
         latin:keyboardLayout="@xml/row_hebrew4" />
diff --git a/java/res/xml-sw600dp/rows_hindi.xml b/java/res/xml-sw600dp/rows_hindi.xml
index f46c1de..c26439f 100644
--- a/java/res/xml-sw600dp/rows_hindi.xml
+++ b/java/res/xml-sw600dp/rows_hindi.xml
@@ -53,8 +53,8 @@
             latin:keyboardLayout="@xml/rowkeys_hindi3" />
         <include
             latin:keyboardLayout="@xml/keys_comma_period" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
             latin:keyXPos="-7.5%p"
             latin:keyWidth="fillRight" />
     </Row>
diff --git a/java/res/xml-sw600dp/rows_nordic.xml b/java/res/xml-sw600dp/rows_nordic.xml
index 57104fa..4cc10d0 100644
--- a/java/res/xml-sw600dp/rows_nordic.xml
+++ b/java/res/xml-sw600dp/rows_nordic.xml
@@ -53,9 +53,9 @@
             latin:keyboardLayout="@xml/rowkeys_qwerty3" />
         <include
             latin:keyboardLayout="@xml/keys_comma_period" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
-            latin:keyXPos="-7.6%p"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyXPos="-10.0%p"
             latin:keyWidth="fillRight" />
     </Row>
     <include
diff --git a/java/res/xml-sw600dp/rows_pcqwerty.xml b/java/res/xml-sw600dp/rows_pcqwerty.xml
index ff2f785..0c74114 100644
--- a/java/res/xml-sw600dp/rows_pcqwerty.xml
+++ b/java/res/xml-sw600dp/rows_pcqwerty.xml
@@ -62,9 +62,9 @@
             latin:keyWidth="15.0%p" />
         <include
             latin:keyboardLayout="@xml/rowkeys_pcqwerty4" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
-            latin:keyXPos="-9.0%p"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyXPos="-15.0%p"
             latin:keyWidth="fillRight" />
     </Row>
     <include
diff --git a/java/res/xml-sw600dp/rows_pcqwerty_symbols.xml b/java/res/xml-sw600dp/rows_pcqwerty_symbols.xml
index 046bce9..dd8df4e 100644
--- a/java/res/xml-sw600dp/rows_pcqwerty_symbols.xml
+++ b/java/res/xml-sw600dp/rows_pcqwerty_symbols.xml
@@ -61,10 +61,6 @@
         <include
             latin:keyboardLayout="@xml/rowkeys_pcqwerty4"
             latin:keyXPos="15.0%p" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
-            latin:keyXPos="-9.0%p"
-            latin:keyWidth="fillRight" />
     </Row>
     <include
         latin:keyboardLayout="@xml/row_pcqwerty5" />
diff --git a/java/res/xml-sw600dp/rows_qwerty.xml b/java/res/xml-sw600dp/rows_qwerty.xml
index 8e8d5ac..9fc0e12 100644
--- a/java/res/xml-sw600dp/rows_qwerty.xml
+++ b/java/res/xml-sw600dp/rows_qwerty.xml
@@ -53,8 +53,8 @@
             latin:keyboardLayout="@xml/rowkeys_qwerty3" />
         <include
             latin:keyboardLayout="@xml/keys_comma_period" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
             latin:keyXPos="-9.0%p"
             latin:keyWidth="fillRight" />
     </Row>
diff --git a/java/res/xml-sw600dp/rows_qwertz.xml b/java/res/xml-sw600dp/rows_qwertz.xml
index d8f5bc6..de86444 100644
--- a/java/res/xml-sw600dp/rows_qwertz.xml
+++ b/java/res/xml-sw600dp/rows_qwertz.xml
@@ -53,8 +53,8 @@
             latin:keyboardLayout="@xml/rowkeys_qwertz3" />
         <include
             latin:keyboardLayout="@xml/keys_comma_period" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
             latin:keyXPos="-9.0%p"
             latin:keyWidth="fillRight" />
     </Row>
diff --git a/java/res/xml-sw600dp/rows_south_slavic.xml b/java/res/xml-sw600dp/rows_south_slavic.xml
index 8636cbb..80eea6d 100644
--- a/java/res/xml-sw600dp/rows_south_slavic.xml
+++ b/java/res/xml-sw600dp/rows_south_slavic.xml
@@ -53,8 +53,8 @@
             latin:keyboardLayout="@xml/rowkeys_south_slavic3" />
         <include
             latin:keyboardLayout="@xml/keys_comma_period" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
             latin:keyXPos="-9.0%p"
             latin:keyWidth="fillRight" />
     </Row>
diff --git a/java/res/xml-sw600dp/rows_spanish.xml b/java/res/xml-sw600dp/rows_spanish.xml
index 9451e42..6aef1d7 100644
--- a/java/res/xml-sw600dp/rows_spanish.xml
+++ b/java/res/xml-sw600dp/rows_spanish.xml
@@ -53,9 +53,9 @@
             latin:keyboardLayout="@xml/rowkeys_qwerty3" />
         <include
             latin:keyboardLayout="@xml/keys_comma_period" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
-            latin:keyXPos="-8.5%p"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyXPos="-10.0%p"
             latin:keyWidth="fillRight" />
     </Row>
     <include
diff --git a/java/res/xml-sw600dp/rows_thai.xml b/java/res/xml-sw600dp/rows_thai.xml
index d4eaa10..fea1baf 100644
--- a/java/res/xml-sw600dp/rows_thai.xml
+++ b/java/res/xml-sw600dp/rows_thai.xml
@@ -57,9 +57,9 @@
             latin:keyWidth="10.0%p" />
         <include
             latin:keyboardLayout="@xml/rowkeys_thai4" />
-        <include
-            latin:keyboardLayout="@xml/key_smiley"
-            latin:keyXPos="-9.0%p"
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyXPos="-10.0%p"
             latin:keyWidth="fillRight" />
     </Row>
     <include
diff --git a/java/res/xml-sw768dp/key_styles_common.xml b/java/res/xml-sw768dp/key_styles_common.xml
index 2577e16..2cae0d2 100644
--- a/java/res/xml-sw768dp/key_styles_common.xml
+++ b/java/res/xml-sw768dp/key_styles_common.xml
@@ -74,6 +74,12 @@
     <include
         latin:keyboardLayout="@xml/key_styles_enter" />
     <key-style
+        latin:styleName="defaultActionKeyStyle"
+        latin:code="!code/key_action_enter"
+        latin:keyIcon="!icon/undefined"
+        latin:backgroundType="functional"
+        latin:parentStyle="defaultEnterKeyStyle" />
+    <key-style
         latin:styleName="spaceKeyStyle"
         latin:code="!code/key_space"
         latin:keyActionFlags="noKeyPreview" />
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index 0d78c39..4d7fe3d 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -33,12 +33,10 @@
 
 import com.android.inputmethod.keyboard.internal.KeySpecParser;
 import com.android.inputmethod.keyboard.internal.KeySpecParser.MoreKeySpec;
-import com.android.inputmethod.keyboard.internal.KeyStyles;
 import com.android.inputmethod.keyboard.internal.KeyStyles.KeyStyle;
 import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
 import com.android.inputmethod.latin.R;
 import com.android.inputmethod.latin.StringUtils;
-import com.android.inputmethod.latin.XmlParseUtils;
 
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
@@ -201,7 +199,6 @@
      */
     public Key(Resources res, Keyboard.Params params, Keyboard.Builder.Row row,
             XmlPullParser parser) throws XmlPullParserException {
-        final KeyStyles keyStyles = params.mKeyStyles;
         final float horizontalGap = isSpacer() ? 0 : params.mHorizontalGap;
         final int keyHeight = row.mRowHeight;
         mVerticalGap = params.mVerticalGap;
@@ -210,17 +207,7 @@
         final TypedArray keyAttr = res.obtainAttributes(Xml.asAttributeSet(parser),
                 R.styleable.Keyboard_Key);
 
-        final KeyStyle style;
-        if (keyAttr.hasValue(R.styleable.Keyboard_Key_keyStyle)) {
-            String styleName = keyAttr.getString(R.styleable.Keyboard_Key_keyStyle);
-            style = keyStyles.getKeyStyle(styleName);
-            if (style == null) {
-                throw new XmlParseUtils.ParseException("Unknown key style: " + styleName, parser);
-            }
-        } else {
-            style = keyStyles.getEmptyKeyStyle();
-        }
-
+        final KeyStyle style = params.mKeyStyles.getKeyStyle(keyAttr, parser);
         final float keyXPos = row.getKeyX(keyAttr);
         final float keyWidth = row.getKeyWidth(keyAttr, keyXPos);
         final int keyYPos = row.getKeyY();
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 4a91353..0d2e9f0 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -659,7 +659,7 @@
                 hintX = keyWidth - params.mKeyShiftedLetterHintPadding
                         - getCharWidth(KEY_LABEL_REFERENCE_CHAR, paint) / 2;
                 paint.getFontMetrics(mFontMetrics);
-                hintY = -mFontMetrics.top + params.mKeyShiftedLetterHintPadding;
+                hintY = -mFontMetrics.top;
                 paint.setTextAlign(Align.CENTER);
             } else { // key.hasHintLetter()
                 // The hint letter is placed at top-right corner of the key. Used mainly on phone.
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java b/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java
index b32172e..80f4f25 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java
@@ -32,24 +32,19 @@
     private static final String TAG = KeyStyles.class.getSimpleName();
     private static final boolean DEBUG = false;
 
-    private final HashMap<String, DeclaredKeyStyle> mStyles =
-            new HashMap<String, DeclaredKeyStyle>();
+    final HashMap<String, KeyStyle> mStyles = new HashMap<String, KeyStyle>();
 
-    private final KeyboardTextsSet mTextsSet;
+    final KeyboardTextsSet mTextsSet;
     private final KeyStyle mEmptyKeyStyle;
+    private static final String EMPTY_STYLE_NAME = "<empty>";
 
     public KeyStyles(KeyboardTextsSet textsSet) {
         mTextsSet = textsSet;
-        mEmptyKeyStyle = new EmptyKeyStyle(textsSet);
+        mEmptyKeyStyle = new EmptyKeyStyle();
+        mStyles.put(EMPTY_STYLE_NAME, mEmptyKeyStyle);
     }
 
-    public static abstract class KeyStyle {
-        protected final KeyboardTextsSet mTextsSet;
-
-        public KeyStyle(KeyboardTextsSet textsSet) {
-            mTextsSet = textsSet;
-        }
-
+    public abstract class KeyStyle {
         public abstract String[] getStringArray(TypedArray a, int index);
         public abstract String getString(TypedArray a, int index);
         public abstract int getInt(TypedArray a, int index, int defaultValue);
@@ -70,11 +65,7 @@
         }
     }
 
-    private static class EmptyKeyStyle extends KeyStyle {
-        public EmptyKeyStyle(KeyboardTextsSet textsSet) {
-            super(textsSet);
-        }
-
+    class EmptyKeyStyle extends KeyStyle {
         @Override
         public String[] getStringArray(TypedArray a, int index) {
             return parseStringArray(a, index);
@@ -96,11 +87,12 @@
         }
     }
 
-    private static class DeclaredKeyStyle extends KeyStyle {
+    private class DeclaredKeyStyle extends KeyStyle {
+        private final String mParentStyleName;
         private final HashMap<Integer, Object> mStyleAttributes = new HashMap<Integer, Object>();
 
-        public DeclaredKeyStyle(KeyboardTextsSet textsSet) {
-            super(textsSet);
+        public DeclaredKeyStyle(String parentStyleName) {
+            mParentStyleName = parentStyleName;
         }
 
         @Override
@@ -108,7 +100,11 @@
             if (a.hasValue(index)) {
                 return parseStringArray(a, index);
             }
-            return (String[])mStyleAttributes.get(index);
+            if (mStyleAttributes.containsKey(index)) {
+                return (String[])mStyleAttributes.get(index);
+            }
+            final KeyStyle parentStyle = mStyles.get(mParentStyleName);
+            return parentStyle.getStringArray(a, index);
         }
 
         @Override
@@ -116,7 +112,11 @@
             if (a.hasValue(index)) {
                 return parseString(a, index);
             }
-            return (String)mStyleAttributes.get(index);
+            if (mStyleAttributes.containsKey(index)) {
+                return (String)mStyleAttributes.get(index);
+            }
+            final KeyStyle parentStyle = mStyles.get(mParentStyleName);
+            return parentStyle.getString(a, index);
         }
 
         @Override
@@ -124,15 +124,21 @@
             if (a.hasValue(index)) {
                 return a.getInt(index, defaultValue);
             }
-            final Integer styleValue = (Integer)mStyleAttributes.get(index);
-            return styleValue != null ? styleValue : defaultValue;
+            if (mStyleAttributes.containsKey(index)) {
+                return (Integer)mStyleAttributes.get(index);
+            }
+            final KeyStyle parentStyle = mStyles.get(mParentStyleName);
+            return parentStyle.getInt(a, index, defaultValue);
         }
 
         @Override
         public int getFlag(TypedArray a, int index) {
-            final int value = a.getInt(index, 0);
-            final Integer styleValue = (Integer)mStyleAttributes.get(index);
-            return (styleValue != null ? styleValue : 0) | value;
+            int value = a.getInt(index, 0);
+            if (mStyleAttributes.containsKey(index)) {
+                value |= (Integer)mStyleAttributes.get(index);
+            }
+            final KeyStyle parentStyle = mStyles.get(mParentStyleName);
+            return value | parentStyle.getFlag(a, index);
         }
 
         void readKeyAttributes(TypedArray keyAttr) {
@@ -177,10 +183,6 @@
                 mStyleAttributes.put(index, parseStringArray(a, index));
             }
         }
-
-        void addParentStyleAttributes(DeclaredKeyStyle parentStyle) {
-            mStyleAttributes.putAll(parentStyle.mStyleAttributes);
-        }
     }
 
     public void parseKeyStyleAttributes(TypedArray keyStyleAttr, TypedArray keyAttrs,
@@ -195,26 +197,28 @@
             }
         }
 
-        final DeclaredKeyStyle style = new DeclaredKeyStyle(mTextsSet);
+        String parentStyleName = EMPTY_STYLE_NAME;
         if (keyStyleAttr.hasValue(R.styleable.Keyboard_KeyStyle_parentStyle)) {
-            final String parentStyle = keyStyleAttr.getString(
-                    R.styleable.Keyboard_KeyStyle_parentStyle);
-            final DeclaredKeyStyle parent = mStyles.get(parentStyle);
-            if (parent == null) {
+            parentStyleName = keyStyleAttr.getString(R.styleable.Keyboard_KeyStyle_parentStyle);
+            if (!mStyles.containsKey(parentStyleName)) {
                 throw new XmlParseUtils.ParseException(
-                        "Unknown parentStyle " + parentStyle, parser);
+                        "Unknown parentStyle " + parentStyleName, parser);
             }
-            style.addParentStyleAttributes(parent);
         }
+        final DeclaredKeyStyle style = new DeclaredKeyStyle(parentStyleName);
         style.readKeyAttributes(keyAttrs);
         mStyles.put(styleName, style);
     }
 
-    public KeyStyle getKeyStyle(String styleName) {
+    public KeyStyle getKeyStyle(TypedArray keyAttr, XmlPullParser parser)
+            throws XmlParseUtils.ParseException {
+        if (!keyAttr.hasValue(R.styleable.Keyboard_Key_keyStyle)) {
+            return mEmptyKeyStyle;
+        }
+        final String styleName = keyAttr.getString(R.styleable.Keyboard_Key_keyStyle);
+        if (!mStyles.containsKey(styleName)) {
+            throw new XmlParseUtils.ParseException("Unknown key style: " + styleName, parser);
+        }
         return mStyles.get(styleName);
     }
-
-    public KeyStyle getEmptyKeyStyle() {
-        return mEmptyKeyStyle;
-    }
 }
diff --git a/java/src/com/android/inputmethod/latin/ImfUtils.java b/java/src/com/android/inputmethod/latin/ImfUtils.java
index af46a02..36f6d8b 100644
--- a/java/src/com/android/inputmethod/latin/ImfUtils.java
+++ b/java/src/com/android/inputmethod/latin/ImfUtils.java
@@ -63,7 +63,8 @@
         return getInputMethodInfoOfThisIme(context).getId();
     }
 
-    public static boolean checkIfSubtypeBelongsToThisIme(Context context, InputMethodSubtype ims) {
+    public static boolean checkIfSubtypeBelongsToThisImeAndEnabled(Context context,
+            InputMethodSubtype ims) {
         final InputMethodInfo myImi = getInputMethodInfoOfThisIme(context);
         final InputMethodManager imm = getInputMethodManager(context);
         // TODO: Cache all subtypes of this IME for optimization
@@ -76,6 +77,19 @@
         return false;
     }
 
+    public static boolean checkIfSubtypeBelongsToThisIme(Context context,
+            InputMethodSubtype ims) {
+        final InputMethodInfo myImi = getInputMethodInfoOfThisIme(context);
+        final int count = myImi.getSubtypeCount();
+        for (int i = 0; i < count; i++) {
+            final InputMethodSubtype subtype = myImi.getSubtypeAt(i);
+            if (subtype.equals(ims)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     public static boolean hasMultipleEnabledIMEsOrSubtypes(Context context,
             final boolean shouldIncludeAuxiliarySubtypes) {
         final InputMethodManager imm = getInputMethodManager(context);
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index ddb478e..83a28c0 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1163,8 +1163,8 @@
         final IBinder token = getWindow().getWindow().getAttributes().token;
         if (mShouldSwitchToLastSubtype) {
             final InputMethodSubtype lastSubtype = mImm.getLastInputMethodSubtype();
-            final boolean lastSubtypeBelongsToThisIme = ImfUtils.checkIfSubtypeBelongsToThisIme(
-                    this, lastSubtype);
+            final boolean lastSubtypeBelongsToThisIme =
+                    ImfUtils.checkIfSubtypeBelongsToThisImeAndEnabled(this, lastSubtype);
             if ((includesOtherImes || lastSubtypeBelongsToThisIme)
                     && mImm.switchToLastInputMethod(token)) {
                 mShouldSwitchToLastSubtype = false;
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 7cbee4f..112bde6 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -385,6 +385,7 @@
         }
         // Don't auto-correct words with multiple capital letter
         autoCorrectionAvailable &= !wordComposer.isMostlyCaps();
+        autoCorrectionAvailable &= !wordComposer.isResumed();
         if (allowsToBeAutoCorrected && suggestionsList.size() > 1 && mAutoCorrectionThreshold > 0
                 && Suggest.shouldBlockAutoCorrectionBySafetyNet(typedWord,
                         suggestionsList.get(1).mWord)) {
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index bd8532e..e27a546 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -38,6 +38,7 @@
     private int[] mYCoordinates;
     private StringBuilder mTypedWord;
     private CharSequence mAutoCorrection;
+    private boolean mIsResumed;
 
     // Cache these values for performance
     private int mCapsCount;
@@ -57,6 +58,7 @@
         mYCoordinates = new int[N];
         mAutoCorrection = null;
         mTrailingSingleQuotesCount = 0;
+        mIsResumed = false;
         refreshSize();
     }
 
@@ -73,6 +75,7 @@
         mIsFirstCharCapitalized = source.mIsFirstCharCapitalized;
         mAutoCapitalized = source.mAutoCapitalized;
         mTrailingSingleQuotesCount = source.mTrailingSingleQuotesCount;
+        mIsResumed = source.mIsResumed;
         refreshSize();
     }
 
@@ -85,6 +88,7 @@
         mCapsCount = 0;
         mIsFirstCharCapitalized = false;
         mTrailingSingleQuotesCount = 0;
+        mIsResumed = false;
         refreshSize();
     }
 
@@ -193,6 +197,7 @@
             int codePoint = Character.codePointAt(word, i);
             addKeyInfo(codePoint, keyboard);
         }
+        mIsResumed = true;
     }
 
     /**
@@ -299,6 +304,13 @@
         return mAutoCorrection;
     }
 
+    /**
+     * @return whether we started composing this word by resuming suggestion on an existing string
+     */
+    public boolean isResumed() {
+        return mIsResumed;
+    }
+
     // `type' should be one of the LastComposedWord.COMMIT_TYPE_* constants above.
     public LastComposedWord commitWord(final int type, final String committedWord,
             final int separatorCode) {
@@ -320,6 +332,7 @@
         mTypedWord.setLength(0);
         refreshSize();
         mAutoCorrection = null;
+        mIsResumed = false;
         return lastComposedWord;
     }
 
@@ -331,5 +344,6 @@
         mTypedWord.append(lastComposedWord.mTypedWord);
         refreshSize();
         mAutoCorrection = null; // This will be filled by the next call to updateSuggestion.
+        mIsResumed = true;
     }
 }