Merge "Add Malayalam keyboard"
diff --git a/java/res/xml-sw600dp/rows_malayalam.xml b/java/res/xml-sw600dp/rows_malayalam.xml
new file mode 100644
index 0000000..1df7e6e
--- /dev/null
+++ b/java/res/xml-sw600dp/rows_malayalam.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2014, 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">
+    <include latin:keyboardLayout="@xml/key_styles_common" />
+    <Row
+        latin:keyWidth="8.182%p"
+        latin:keyLabelFlags="fontNormal|autoXScale"
+    >
+        <include latin:keyboardLayout="@xml/rowkeys_malayalam1" />
+        <Key
+            latin:keyStyle="deleteKeyStyle"
+            latin:keyWidth="fillRight" />
+    </Row>
+    <Row
+        latin:keyWidth="8.182%p"
+        latin:keyLabelFlags="fontNormal|autoXScale"
+    >
+        <include latin:keyboardLayout="@xml/rowkeys_malayalam2" />
+        <Key
+            latin:keyStyle="enterKeyStyle"
+            latin:keyWidth="fillRight" />
+    </Row>
+    <Row
+        latin:keyWidth="8.182%p"
+        latin:keyLabelFlags="fontNormal|autoXScale"
+    >
+        <include latin:keyboardLayout="@xml/rowkeys_malayalam3" />
+        <include latin:keyboardLayout="@xml/keys_exclamation_question" />
+    </Row>
+    <include latin:keyboardLayout="@xml/row_qwerty4" />
+</merge>
diff --git a/java/res/xml/kbd_malayalam.xml b/java/res/xml/kbd_malayalam.xml
new file mode 100644
index 0000000..000b23f
--- /dev/null
+++ b/java/res/xml/kbd_malayalam.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2014, 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.
+*/
+-->
+
+<Keyboard
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <include
+        latin:keyboardLayout="@xml/rows_malayalam" />
+</Keyboard>
diff --git a/java/res/xml/keyboard_layout_set_malayalam.xml b/java/res/xml/keyboard_layout_set_malayalam.xml
new file mode 100644
index 0000000..14c76ba
--- /dev/null
+++ b/java/res/xml/keyboard_layout_set_malayalam.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2014, 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.
+*/
+-->
+
+<KeyboardLayoutSet
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+    <Element
+        latin:elementName="alphabet"
+        latin:elementKeyboard="@xml/kbd_malayalam"
+        latin:enableProximityCharsCorrection="true" />
+    <Element
+        latin:elementName="symbols"
+        latin:elementKeyboard="@xml/kbd_symbols" />
+    <Element
+        latin:elementName="symbolsShifted"
+        latin:elementKeyboard="@xml/kbd_symbols_shift" />
+    <Element
+        latin:elementName="phone"
+        latin:elementKeyboard="@xml/kbd_phone" />
+    <Element
+        latin:elementName="phoneSymbols"
+        latin:elementKeyboard="@xml/kbd_phone_symbols" />
+    <Element
+        latin:elementName="number"
+        latin:elementKeyboard="@xml/kbd_number" />
+</KeyboardLayoutSet>
diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml
index 7a6640b..6d4d3f2 100644
--- a/java/res/xml/method.xml
+++ b/java/res/xml/method.xml
@@ -68,6 +68,7 @@
     lt: Lithuanian/qwerty
     lv: Latvian/qwerty
     mk: Macedonian/south_slavic
+    (ml_IN: Malayalam (India)/malayalam) # This is a preliminary keyboard layout.
     mn_MN: Mongolian (Mongolia)/mongolian
     (mr_IN: Marathi (India)/marathi) # This is a preliminary keyboard layout.
     ms_MY: Malay (Malaysia)/qwerty
@@ -483,6 +484,16 @@
             android:imeSubtypeExtraValue="KeyboardLayoutSet=south_slavic,EmojiCapable"
             android:isAsciiCapable="false"
     />
+    <!-- TODO: This malayalam keyboard is a preliminary layout.
+               This isn't based on the final specification. -->
+    <subtype android:icon="@drawable/ic_ime_switcher_dark"
+            android:label="@string/subtype_generic"
+            android:subtypeId="0xc182ebd4"
+            android:imeSubtypeLocale="ml_IN"
+            android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=malayalam,EmojiCapable"
+            android:isAsciiCapable="false"
+    />
     <subtype android:icon="@drawable/ic_ime_switcher_dark"
             android:label="@string/subtype_generic"
             android:subtypeId="0xcdcfc3ab"
diff --git a/java/res/xml/rowkeys_malayalam1.xml b/java/res/xml/rowkeys_malayalam1.xml
new file mode 100644
index 0000000..79d96cb
--- /dev/null
+++ b/java/res/xml/rowkeys_malayalam1.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2014, 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" >
+    <!-- U+0D4D: "്" MALAYALAM SIGN VIRAMA
+         U+0D05: "അ" MALAYALAM LETTER A -->
+    <Key
+        latin:keySpec="&#x0D4D;"
+        latin:moreKeys="&#x0D05;,%"
+        latin:keyHintLabel="1"
+        latin:additionalMoreKeys="1" />
+    <!-- U+0D3E: "ാ" MALAYALAM VOWEL SIGN AA
+         U+0D06: "ആ" MALAYALAM LETTER AA -->
+    <Key
+        latin:keySpec="&#x0D3E;"
+        latin:moreKeys="&#x0D06;,%"
+        latin:keyHintLabel="2"
+        latin:additionalMoreKeys="2" />
+    <!-- U+0D3F: "ി" MALAYALAM VOWEL SIGN I
+         U+0D07: "ഇ" MALAYALAM LETTER I -->
+    <Key
+        latin:keySpec="&#x0D3F;"
+        latin:moreKeys="&#x0D07;,%"
+        latin:keyHintLabel="3"
+        latin:additionalMoreKeys="3" />
+    <!-- U+0D40: "ീ" MALAYALAM VOWEL SIGN II
+         U+0D08: "ഈ" MALAYALAM LETTER II -->
+    <Key
+        latin:keySpec="&#x0D40;"
+        latin:moreKeys="&#x0D08;,%"
+        latin:keyHintLabel="4"
+        latin:additionalMoreKeys="4" />
+    <!-- U+0D41: "ു" MALAYALAM VOWEL SIGN U
+         U+0D09: "ഉ" MALAYALAM LETTER U -->
+    <Key
+        latin:keySpec="&#x0D41;"
+        latin:moreKeys="&#x0D09;,%"
+        latin:keyHintLabel="5"
+        latin:additionalMoreKeys="5" />
+    <!-- U+0D42: "ൂ" MALAYALAM VOWEL SIGN UU
+         U+0D0A: "ഊ" MALAYALAM LETTER UU -->
+    <Key
+        latin:keySpec="&#x0D42;"
+        latin:moreKeys="&#x0D0A;,%"
+        latin:keyHintLabel="6"
+        latin:additionalMoreKeys="6" />
+    <!-- U+0D43: "ൃ" MALAYALAM VOWEL SIGN VOCALIC R
+         U+0D0B: "ഋ" MALAYALAM LETTER VOCALIC R -->
+    <Key
+        latin:keySpec="&#x0D43;"
+        latin:moreKeys="&#x0D0B;,%"
+        latin:keyHintLabel="7"
+        latin:additionalMoreKeys="7" />
+    <!-- U+0D46: "െ" MALAYALAM VOWEL SIGN E
+         U+0D0E: "എ" MALAYALAM LETTER E
+         U+0D10: "ഐ" MALAYALAM LETTER AI
+         U+0D48: "ൈ" MALAYALAM VOWEL SIGN AI -->
+    <Key
+        latin:keySpec="&#x0D46;"
+        latin:moreKeys="&#x0D0E;,&#x0D10;,&#x0D48;,%"
+        latin:keyHintLabel="8"
+        latin:additionalMoreKeys="8" />
+    <!-- U+0D47: "േ" MALAYALAM VOWEL SIGN EE
+         U+0D0F: "ഏ" MALAYALAM LETTER EE -->
+    <Key
+        latin:keySpec="&#x0D47;"
+        latin:moreKeys="&#x0D0F;,%"
+        latin:keyHintLabel="9"
+        latin:additionalMoreKeys="9" />
+    <!-- U+0D4A: "ൊ" MALAYALAM VOWEL SIGN O
+         U+0D12: "ഒ" MALAYALAM LETTER O -->
+    <Key
+        latin:keySpec="&#x0D4A;"
+        latin:moreKeys="&#x0D12;,%"
+        latin:keyHintLabel="0"
+        latin:additionalMoreKeys="0" />
+    <!-- U+0D4B: "ോ" MALAYALAM VOWEL SIGN OO
+         U+0D13: "ഓ" MALAYALAM LETTER OO
+         U+0D14: "ഔ" MALAYALAM LETTER AU
+         U+0D57: "ൗ" MALAYALAM AU LENGTH MARK -->
+    <Key latin:keySpec="&#x0D4B;"
+         latin:moreKeys="&#x0D13;,&#x0D14;,&#x0D57;" />
+</merge>
diff --git a/java/res/xml/rowkeys_malayalam2.xml b/java/res/xml/rowkeys_malayalam2.xml
new file mode 100644
index 0000000..f0f9df0
--- /dev/null
+++ b/java/res/xml/rowkeys_malayalam2.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2014, 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">
+    <!-- U+0D15: "ക" MALAYALAM LETTER KA
+         U+0D16: "ഖ" MALAYALAM LETTER KHA -->
+    <Key
+        latin:keySpec="&#x0D15;"
+        latin:moreKeys="&#x0D16;" />
+    <!-- U+0D17: "ഗ" MALAYALAM LETTER GA
+         U+0D18: "ഘ" MALAYALAM LETTER GHA -->
+    <Key
+        latin:keySpec="&#x0D17;"
+        latin:moreKeys="&#x0D18;" />
+    <!-- U+0D19: "ങ" MALAYALAM LETTER NGA
+         U+0D1E: "ഞ" MALAYALAM LETTER NYA -->
+    <Key
+        latin:keySpec="&#x0D19;"
+        latin:moreKeys="&#x0D1E;" />
+    <!-- U+0D1A: "ച" MALAYALAM LETTER CA
+         U+0D1B: "ഛ" MALAYALAM LETTER CHA -->
+    <Key
+        latin:keySpec="&#x0D1A;"
+        latin:moreKeys="&#x0D1B;" />
+    <!-- U+0D1C: "ജ" MALAYALAM LETTER JA
+         U+0D1D: "ഝ" MALAYALAM LETTER JHA -->
+    <Key
+        latin:keySpec="&#x0D1C;"
+        latin:moreKeys="&#x0D1D;" />
+    <!-- U+0D1F: "ട" MALAYALAM LETTER TTA
+         U+0D20: "ഠ" MALAYALAM LETTER TTHA -->
+    <Key
+        latin:keySpec="&#x0D1F;"
+        latin:moreKeys="&#x0D20;" />
+    <!-- U+0D21: "ഡ" MALAYALAM LETTER DDA
+         U+0D22: "ഢ" MALAYALAM LETTER DDHA -->
+    <Key
+        latin:keySpec="&#x0D21;"
+        latin:moreKeys="&#x0D22;" />
+    <!-- U+0D23: "ണ" MALAYALAM LETTER NNA
+         U+0D7A: "ൺ" MALAYALAM LETTER CHILLU NN -->
+    <Key
+        latin:keySpec="&#x0D23;"
+        latin:moreKeys="&#x0D7A;" />
+    <!-- U+0D24: "ത" MALAYALAM LETTER TA
+         U+0D25: "ഥ" MALAYALAM LETTER THA -->
+    <Key
+        latin:keySpec="&#x0D24;"
+        latin:moreKeys="&#x0D25;" />
+    <!-- U+0D26: "ദ" MALAYALAM LETTER DA
+         U+0D27: "ധ" MALAYALAM LETTER DHA -->
+    <Key
+        latin:keySpec="&#x0D26;"
+        latin:moreKeys="&#x0D27;" />
+    <!-- U+0D28: "ഗന" MALAYALAM LETTER NA
+         U+0D7B: "ൻ" MALAYALAM LETTER CHILLU N -->
+    <Key
+        latin:keySpec="&#x0D28;"
+        latin:moreKeys="&#x0D7B;" />
+</merge>
diff --git a/java/res/xml/rowkeys_malayalam3.xml b/java/res/xml/rowkeys_malayalam3.xml
new file mode 100644
index 0000000..6959ccd
--- /dev/null
+++ b/java/res/xml/rowkeys_malayalam3.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2014, 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">
+    <!-- U+0D2A: "പ" MALAYALAM LETTER PA
+         U+0D2B: "ഫ" MALAYALAM LETTER PHA -->
+    <Key
+        latin:keySpec="&#x0D2A;"
+        latin:moreKeys="&#x0D2B;" />
+    <!-- U+0D2C: "ബ" MALAYALAM LETTER BA
+         U+0D2D: "ഭ" MALAYALAM LETTER BHA -->
+    <Key
+        latin:keySpec="&#x0D2C;"
+        latin:moreKeys="&#x0D2D;" />
+    <!-- U+0D2E: "മ" MALAYALAM LETTER MA
+         U+0D02: "ം" MALAYALAM SIGN ANUSVARA -->
+    <Key
+        latin:keySpec="&#x0D2E;"
+        latin:moreKeys="&#x0D02;" />
+    <!-- U+0D2F: "യ" MALAYALAM LETTER YA
+         U+0D4D/U+0D2F: "്യ" MALAYALAM SIGN VIRAMA/MALAYALAM LETTER YA -->
+    <Key
+        latin:keySpec="&#x0D2F;"
+        latin:moreKeys="&#x0D4D;&#x0D2F;" />
+    <!-- U+0D30: "ര" MALAYALAM LETTER RA
+         U+0D4D/U+0D30: "്ര" MALAYALAM SIGN VIRAMA/MALAYALAM LETTER RA
+         U+0D7C: "ർ" MALAYALAM LETTER CHILLU RR
+         U+0D31: "റ" MALAYALAM LETTER RRA -->
+    <Key
+        latin:keySpec="&#x0D30;"
+        latin:moreKeys="&#x0D4D;&#x0D30;,&#x0D7C;,&#x0D31;" />
+    <!-- U+0D32: "ല" MALAYALAM LETTER LA
+         U+0D7D: "ൽ" MALAYALAM LETTER CHILLU L -->
+    <Key
+        latin:keySpec="&#x0D32;"
+        latin:moreKeys="&#x0D7D;" />
+    <!-- U+0D35: "വ" MALAYALAM LETTER VA
+         U+0D4D/U+0D35: "്വ" MALAYALAM SIGN VIRAMA/MALAYALAM LETTER VA -->
+    <Key
+        latin:keySpec="&#x0D35;"
+        latin:moreKeys="&#x0D4D;&#x0D35;" />
+    <!-- U+0D36: "ശ" MALAYALAM LETTER SHA
+         U+0D37: "ഷ" MALAYALAM LETTER SSA
+         U+0D38: "സ" MALAYALAM LETTER SA -->
+    <Key
+        latin:keySpec="&#x0D36;"
+        latin:moreKeys="&#x0D37;,&#x0D38;" />
+    <!-- U+0D39: "ഹ" MALAYALAM LETTER HA
+         U+0D03: "ഃ" MALAYALAM SIGN VISARGA -->
+    <Key
+        latin:keySpec="&#x0D39;"
+        latin:moreKeys="&#x0D03;" />
+    <!-- U+0D33: "ള" MALAYALAM LETTER LLA
+         U+0D7E: "ൾ" MALAYALAM LETTER CHILLU LL
+         U+0D34: "ഴ" MALAYALAM LETTER LLLA -->
+    <Key
+        latin:keySpec="&#x0D33;"
+        latin:moreKeys="&#x0D7E;,&#x0D34;" />
+</merge>
diff --git a/java/res/xml/rows_malayalam.xml b/java/res/xml/rows_malayalam.xml
new file mode 100644
index 0000000..5e7a491
--- /dev/null
+++ b/java/res/xml/rows_malayalam.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2014, 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">
+    <include latin:keyboardLayout="@xml/key_styles_common" />
+    <Row
+        latin:keyWidth="9.091%p"
+        latin:keyLabelFlags="fontNormal|autoXScale"
+    >
+        <include latin:keyboardLayout="@xml/rowkeys_malayalam1" />
+    </Row>
+    <Row
+        latin:keyWidth="9.091%p"
+        latin:keyLabelFlags="fontNormal|autoXScale"
+    >
+        <include latin:keyboardLayout="@xml/rowkeys_malayalam2" />
+    </Row>
+    <Row
+        latin:keyWidth="9.091%p"
+        latin:keyLabelFlags="fontNormal|autoXScale"
+    >
+        <include latin:keyboardLayout="@xml/rowkeys_malayalam3" />
+        <Key
+            latin:keyStyle="deleteKeyStyle"
+            latin:keyWidth="fillRight" />
+    </Row>
+    <include latin:keyboardLayout="@xml/row_qwerty4" />
+</merge>
\ No newline at end of file
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.java
index 8b8a9dd..4c8c37a 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.java
@@ -88,7 +88,7 @@
         /*   2:30 */ "morekeys_u",
         /*   3:29 */ "morekeys_e",
         /*   4:28 */ "morekeys_i",
-        /*   5:25 */ "keylabel_to_alpha",
+        /*   5:26 */ "keylabel_to_alpha",
         /*   6:23 */ "morekeys_c",
         /*   7:23 */ "double_quotes",
         /*   8:22 */ "morekeys_n",
@@ -96,8 +96,8 @@
         /*  10:20 */ "morekeys_s",
         /*  11:14 */ "morekeys_y",
         /*  12:13 */ "morekeys_d",
-        /*  13:12 */ "morekeys_z",
-        /*  14:12 */ "keyspec_currency",
+        /*  13:13 */ "keyspec_currency",
+        /*  14:12 */ "morekeys_z",
         /*  15:10 */ "morekeys_t",
         /*  16:10 */ "morekeys_l",
         /*  17: 9 */ "morekeys_g",
@@ -267,11 +267,11 @@
         /* morekeys_n */ EMPTY,
         /* single_quotes */ "!text/single_lqm_rqm",
         /* morekeys_s ~ */
-        EMPTY, EMPTY, EMPTY, EMPTY,
-        /* ~ morekeys_z */
-        /* keyspec_currency */ "$",
-        /* morekeys_t ~ */
         EMPTY, EMPTY, EMPTY,
+        /* ~ morekeys_d */
+        /* keyspec_currency */ "$",
+        /* morekeys_z ~ */
+        EMPTY, EMPTY, EMPTY, EMPTY,
         /* ~ morekeys_g */
         /* single_angle_quotes */ "!text/single_laqm_raqm",
         /* double_angle_quotes */ "!text/double_laqm_raqm",
@@ -764,8 +764,8 @@
         // U+0997: "ग" BENGALI LETTER GA
         /* keylabel_to_alpha */ "\u0995\u0996\u0997",
         /* morekeys_c ~ */
-        null, null, null, null, null, null, null, null,
-        /* ~ morekeys_z */
+        null, null, null, null, null, null, null,
+        /* ~ morekeys_d */
         // U+09F3: "৳" BENGALI RUPEE SIGN
         /* keyspec_currency */ "\u09F3",
     };
@@ -909,11 +909,11 @@
         /* morekeys_y */ "\u00FD,\u00FF",
         // U+010F: "ď" LATIN SMALL LETTER D WITH CARON
         /* morekeys_d */ "\u010F",
+        /* keyspec_currency */ null,
         // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
         // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
         // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
         /* morekeys_z */ "\u017E,\u017A,\u017C",
-        /* keyspec_currency */ null,
         // U+0165: "ť" LATIN SMALL LETTER T WITH CARON
         /* morekeys_t */ "\u0165",
         /* morekeys_l */ null,
@@ -968,7 +968,7 @@
         /* morekeys_y */ "\u00FD,\u00FF",
         // U+00F0: "ð" LATIN SMALL LETTER ETH
         /* morekeys_d */ "\u00F0",
-        /* morekeys_z ~ */
+        /* keyspec_currency ~ */
         null, null, null,
         /* ~ morekeys_t */
         // U+0142: "ł" LATIN SMALL LETTER L WITH STROKE
@@ -1209,11 +1209,11 @@
         // U+010F: "ď" LATIN SMALL LETTER D WITH CARON
         // U+0111: "đ" LATIN SMALL LETTER D WITH STROKE
         /* morekeys_d */ "\u00F0,\u010F,\u0111",
+        /* keyspec_currency */ null,
         // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
         // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
         // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
         /* morekeys_z */ "\u017A,\u017C,\u017E",
-        /* keyspec_currency */ null,
         // U+0165: "ť" LATIN SMALL LETTER T WITH CARON
         // U+021B: "ț" LATIN SMALL LETTER T WITH COMMA BELOW
         // U+0163: "ţ" LATIN SMALL LETTER T WITH CEDILLA
@@ -1403,11 +1403,11 @@
         /* morekeys_y */ "\u00FD,\u00FF",
         // U+010F: "ď" LATIN SMALL LETTER D WITH CARON
         /* morekeys_d */ "\u010F",
+        /* keyspec_currency */ null,
         // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
         // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
         // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
         /* morekeys_z */ "\u017E,\u017C,\u017A",
-        /* keyspec_currency */ null,
         // U+0163: "ţ" LATIN SMALL LETTER T WITH CEDILLA
         // U+0165: "ť" LATIN SMALL LETTER T WITH CARON
         /* morekeys_t */ "\u0163,\u0165",
@@ -1505,13 +1505,13 @@
         // U+067E: "پ" ARABIC LETTER PEH
         /* keylabel_to_alpha */ "\u0627\u200C\u0628\u200C\u067E",
         /* morekeys_c ~ */
-        null, null, null, null, null, null, null, null,
-        /* ~ morekeys_z */
+        null, null, null, null, null, null, null,
+        /* ~ morekeys_d */
         // U+FDFC: "﷼" RIAL SIGN
         /* keyspec_currency */ "\uFDFC",
-        /* morekeys_t ~ */
+        /* morekeys_z ~ */
         null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-        null, null,
+        null, null, null,
         /* ~ morekeys_cyrillic_soft_sign */
         // U+06F1: "۱" EXTENDED ARABIC-INDIC DIGIT ONE
         /* keyspec_symbols_1 */ "\u06F1",
@@ -1663,14 +1663,15 @@
         // U+00DF: "ß" LATIN SMALL LETTER SHARP S
         // U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE
         /* morekeys_s */ "\u0161,\u00DF,\u015B",
-        /* morekeys_y */ null,
-        /* morekeys_d */ null,
+        /* morekeys_y ~ */
+        null, null, null,
+        /* ~ keyspec_currency */
         // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
         // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
         // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
         /* morekeys_z */ "\u017E,\u017A,\u017C",
-        /* keyspec_currency ~ */
-        null, null, null, null, null, null, null, null, null,
+        /* morekeys_t ~ */
+        null, null, null, null, null, null, null, null,
         /* ~ morekeys_cyrillic_ie */
         // U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
         /* keyspec_nordic_row1_11 */ "\u00E5",
@@ -1826,13 +1827,13 @@
         // U+0917: "ग" DEVANAGARI LETTER GA
         /* keylabel_to_alpha */ "\u0915\u0916\u0917",
         /* morekeys_c ~ */
-        null, null, null, null, null, null, null, null,
-        /* ~ morekeys_z */
+        null, null, null, null, null, null, null,
+        /* ~ morekeys_d */
         // U+20B9: "₹" INDIAN RUPEE SIGN
         /* keyspec_currency */ "\u20B9",
-        /* morekeys_t ~ */
+        /* morekeys_z ~ */
         null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-        null, null,
+        null, null, null,
         /* ~ morekeys_cyrillic_soft_sign */
         // U+0967: "१" DEVANAGARI DIGIT ONE
         /* keyspec_symbols_1 */ "\u0967",
@@ -1889,12 +1890,13 @@
         /* morekeys_y */ null,
         // U+0111: "đ" LATIN SMALL LETTER D WITH STROKE
         /* morekeys_d */ "\u0111",
+        /* keyspec_currency */ null,
         // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
         // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
         // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
         /* morekeys_z */ "\u017E,\u017A,\u017C",
-        /* keyspec_currency ~ */
-        null, null, null, null,
+        /* morekeys_t ~ */
+        null, null, null,
         /* ~ morekeys_g */
         /* single_angle_quotes */ "!text/single_raqm_laqm",
         /* double_angle_quotes */ "!text/double_raqm_laqm",
@@ -2068,8 +2070,8 @@
         /* morekeys_y */ "\u00FD,\u00FF",
         // U+00F0: "ð" LATIN SMALL LETTER ETH
         /* morekeys_d */ "\u00F0",
-        /* morekeys_z */ null,
         /* keyspec_currency */ null,
+        /* morekeys_z */ null,
         // U+00FE: "þ" LATIN SMALL LETTER THORN
         /* morekeys_t */ "\u00FE",
     };
@@ -2152,15 +2154,15 @@
         /* morekeys_n */ null,
         /* single_quotes */ "!text/single_rqm_9qm",
         /* morekeys_s ~ */
-        null, null, null, null,
-        /* ~ morekeys_z */
+        null, null, null,
+        /* ~ morekeys_d */
         // U+20AA: "₪" NEW SHEQEL SIGN
         /* keyspec_currency */ "\u20AA",
-        /* morekeys_t ~ */
+        /* morekeys_z ~ */
         null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
         null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
         null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-        null, null,
+        null, null, null,
         /* ~ morekeys_swiss_row2_11 */
         // U+2605: "★" BLACK STAR
         /* morekeys_star */ "\u2605",
@@ -2349,8 +2351,8 @@
         // U+0E84: "ຄ" LAO LETTER KHO TAM
         /* keylabel_to_alpha */ "\u0E81\u0E82\u0E84",
         /* morekeys_c ~ */
-        null, null, null, null, null, null, null, null,
-        /* ~ morekeys_z */
+        null, null, null, null, null, null, null,
+        /* ~ morekeys_d */
         // U+20AD: "₭" KIP SIGN
         /* keyspec_currency */ "\u20AD",
     };
@@ -2424,11 +2426,11 @@
         /* morekeys_y */ "\u00FD,\u00FF",
         // U+010F: "ď" LATIN SMALL LETTER D WITH CARON
         /* morekeys_d */ "\u010F",
+        /* keyspec_currency */ null,
         // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
         // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
         // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
         /* morekeys_z */ "\u017E,\u017C,\u017A",
-        /* keyspec_currency */ null,
         // U+0163: "ţ" LATIN SMALL LETTER T WITH CEDILLA
         // U+0165: "ť" LATIN SMALL LETTER T WITH CARON
         /* morekeys_t */ "\u0163,\u0165",
@@ -2518,11 +2520,11 @@
         /* morekeys_y */ "\u00FD,\u00FF",
         // U+010F: "ď" LATIN SMALL LETTER D WITH CARON
         /* morekeys_d */ "\u010F",
+        /* keyspec_currency */ null,
         // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
         // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
         // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
         /* morekeys_z */ "\u017E,\u017C,\u017A",
-        /* keyspec_currency */ null,
         // U+0163: "ţ" LATIN SMALL LETTER T WITH CEDILLA
         // U+0165: "ť" LATIN SMALL LETTER T WITH CARON
         /* morekeys_t */ "\u0163,\u0165",
@@ -2582,6 +2584,21 @@
         /* keyspec_south_slavic_row3_8 */ "\u0453",
     };
 
+    /* Locale ml_IN: Malayalam (India) */
+    private static final String[] TEXTS_ml_IN = {
+        /* morekeys_a ~ */
+        null, null, null, null, null,
+        /* ~ morekeys_i */
+        // Label for "switch to alphabetic" key.
+        // U+0D05: "അ" MALAYALAM LETTER A
+        /* keylabel_to_alpha */ "\u0D05",
+        /* morekeys_c ~ */
+        null, null, null, null, null, null, null,
+        /* ~ morekeys_d */
+        // U+20B9: "₹" INDIAN RUPEE SIGN
+        /* keyspec_currency */ "\u20B9",
+    };
+
     /* Locale mn_MN: Mongolian (Mongolia) */
     private static final String[] TEXTS_mn_MN = {
         /* morekeys_a ~ */
@@ -2593,8 +2610,8 @@
         // U+0412: "В" CYRILLIC CAPITAL LETTER VE
         /* keylabel_to_alpha */ "\u0410\u0411\u0412",
         /* morekeys_c ~ */
-        null, null, null, null, null, null, null, null,
-        /* ~ morekeys_z */
+        null, null, null, null, null, null, null,
+        /* ~ morekeys_d */
         // U+20AE: "₮" TUGRIK SIGN
         /* keyspec_currency */ "\u20AE",
     };
@@ -2610,13 +2627,13 @@
         // U+0917: "ग" DEVANAGARI LETTER GA
         /* keylabel_to_alpha */ "\u0915\u0916\u0917",
         /* morekeys_c ~ */
-        null, null, null, null, null, null, null, null,
-        /* ~ morekeys_z */
+        null, null, null, null, null, null, null,
+        /* ~ morekeys_d */
         // U+20B9: "₹" INDIAN RUPEE SIGN
         /* keyspec_currency */ "\u20B9",
-        /* morekeys_t ~ */
+        /* morekeys_z ~ */
         null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-        null, null,
+        null, null, null,
         /* ~ morekeys_cyrillic_soft_sign */
         // U+0967: "१" DEVANAGARI DIGIT ONE
         /* keyspec_symbols_1 */ "\u0967",
@@ -2757,13 +2774,13 @@
         // U+0917: "ग" DEVANAGARI LETTER GA
         /* keylabel_to_alpha */ "\u0915\u0916\u0917",
         /* morekeys_c ~ */
-        null, null, null, null, null, null, null, null,
-        /* ~ morekeys_z */
+        null, null, null, null, null, null, null,
+        /* ~ morekeys_d */
         // U+0930/U+0941/U+002E "रु." NEPALESE RUPEE SIGN
         /* keyspec_currency */ "\u0930\u0941.",
-        /* morekeys_t ~ */
+        /* morekeys_z ~ */
         null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-        null, null,
+        null, null, null,
         /* ~ morekeys_cyrillic_soft_sign */
         // U+0967: "१" DEVANAGARI DIGIT ONE
         /* keyspec_symbols_1 */ "\u0967",
@@ -2898,13 +2915,13 @@
         // U+00DF: "ß" LATIN SMALL LETTER SHARP S
         // U+0161: "š" LATIN SMALL LETTER S WITH CARON
         /* morekeys_s */ "\u015B,\u00DF,\u0161",
-        /* morekeys_y */ null,
-        /* morekeys_d */ null,
+        /* morekeys_y ~ */
+        null, null, null,
+        /* ~ keyspec_currency */
         // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
         // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
         // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
         /* morekeys_z */ "\u017C,\u017A,\u017E",
-        /* keyspec_currency */ null,
         /* morekeys_t */ null,
         // U+0142: "ł" LATIN SMALL LETTER L WITH STROKE
         /* morekeys_l */ "\u0142",
@@ -3006,7 +3023,7 @@
         /* morekeys_s */ "\u0219,\u00DF,\u015B,\u0161",
         /* morekeys_y ~ */
         null, null, null, null,
-        /* ~ keyspec_currency */
+        /* ~ morekeys_z */
         // U+021B: "ț" LATIN SMALL LETTER T WITH COMMA BELOW
         /* morekeys_t */ "\u021B",
     };
@@ -3125,11 +3142,11 @@
         /* morekeys_y */ "\u00FD,\u00FF",
         // U+010F: "ď" LATIN SMALL LETTER D WITH CARON
         /* morekeys_d */ "\u010F",
+        /* keyspec_currency */ null,
         // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
         // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
         // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
         /* morekeys_z */ "\u017E,\u017C,\u017A",
-        /* keyspec_currency */ null,
         // U+0165: "ť" LATIN SMALL LETTER T WITH CARON
         // U+0163: "ţ" LATIN SMALL LETTER T WITH CEDILLA
         /* morekeys_t */ "\u0165,\u0163",
@@ -3167,10 +3184,11 @@
         /* morekeys_y */ null,
         // U+0111: "đ" LATIN SMALL LETTER D WITH STROKE
         /* morekeys_d */ "\u0111",
+        /* keyspec_currency */ null,
         // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
         /* morekeys_z */ "\u017E",
-        /* keyspec_currency ~ */
-        null, null, null, null,
+        /* morekeys_t ~ */
+        null, null, null,
         /* ~ morekeys_g */
         /* single_angle_quotes */ "!text/single_raqm_laqm",
         /* double_angle_quotes */ "!text/double_raqm_laqm",
@@ -3290,11 +3308,11 @@
         // U+00F0: "ð" LATIN SMALL LETTER ETH
         // U+010F: "ď" LATIN SMALL LETTER D WITH CARON
         /* morekeys_d */ "\u00F0,\u010F",
+        /* keyspec_currency */ null,
         // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
         // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
         // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
         /* morekeys_z */ "\u017A,\u017E,\u017C",
-        /* keyspec_currency */ null,
         // U+0165: "ť" LATIN SMALL LETTER T WITH CARON
         // U+00FE: "þ" LATIN SMALL LETTER THORN
         /* morekeys_t */ "\u0165,\u00FE",
@@ -3389,8 +3407,8 @@
         // U+0BB4/U+0BCD: "ழ்" TAMIL LETTER LLLA/TAMIL SIGN VIRAMA
         /* keylabel_to_alpha */ "\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD",
         /* morekeys_c ~ */
-        null, null, null, null, null, null, null, null,
-        /* ~ morekeys_z */
+        null, null, null, null, null, null, null,
+        /* ~ morekeys_d */
         // U+0BF9: "௹" TAMIL RUPEE SIGN
         /* keyspec_currency */ "\u0BF9",
     };
@@ -3406,8 +3424,8 @@
         // U+0E04: "ค" THAI CHARACTER KHO KHWAI
         /* keylabel_to_alpha */ "\u0E01\u0E02\u0E04",
         /* morekeys_c ~ */
-        null, null, null, null, null, null, null, null,
-        /* ~ morekeys_z */
+        null, null, null, null, null, null, null,
+        /* ~ morekeys_d */
         // U+0E3F: "฿" THAI CURRENCY SYMBOL BAHT
         /* keyspec_currency */ "\u0E3F",
     };
@@ -3530,12 +3548,12 @@
         /* morekeys_n */ null,
         /* single_quotes */ "!text/single_9qm_lqm",
         /* morekeys_s ~ */
-        null, null, null, null,
-        /* ~ morekeys_z */
+        null, null, null,
+        /* ~ morekeys_d */
         // U+20B4: "₴" HRYVNIA SIGN
         /* keyspec_currency */ "\u20B4",
-        /* morekeys_t ~ */
-        null, null, null, null, null, null, null, null, null, null, null, null,
+        /* morekeys_z ~ */
+        null, null, null, null, null, null, null, null, null, null, null, null, null,
         /* ~ morekeys_nordic_row2_10 */
         // U+0449: "щ" CYRILLIC SMALL LETTER SHCHA
         /* keyspec_east_slavic_row1_9 */ "\u0449",
@@ -3640,7 +3658,6 @@
         /* morekeys_y */ "\u1EF3,\u00FD,\u1EF7,\u1EF9,\u1EF5",
         // U+0111: "đ" LATIN SMALL LETTER D WITH STROKE
         /* morekeys_d */ "\u0111",
-        /* morekeys_z */ null,
         // U+20AB: "₫" DONG SIGN
         /* keyspec_currency */ "\u20AB",
     };
@@ -3785,11 +3802,11 @@
         // U+0111: "đ" LATIN SMALL LETTER D WITH STROKE
         // U+00F0: "ð" LATIN SMALL LETTER ETH
         /* morekeys_d */ "\u010F,\u0111,\u00F0",
+        /* keyspec_currency */ null,
         // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
         // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
         // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
         /* morekeys_z */ "\u017A,\u017C,\u017E",
-        /* keyspec_currency */ null,
         // U+00FE: "þ" LATIN SMALL LETTER THORN
         // U+0163: "ţ" LATIN SMALL LETTER T WITH CEDILLA
         // U+0165: "ť" LATIN SMALL LETTER T WITH CARON
@@ -3841,7 +3858,7 @@
         "az_AZ"  , TEXTS_az_AZ, /*   8/ 18 Azerbaijani (Azerbaijan) */
         "be_BY"  , TEXTS_be_BY, /*   9/ 32 Belarusian (Belarus) */
         "bg"     , TEXTS_bg,    /*   2/  8 Bulgarian */
-        "bn_IN"  , TEXTS_bn_IN, /*   2/ 15 Bengali (India) */
+        "bn_IN"  , TEXTS_bn_IN, /*   2/ 14 Bengali (India) */
         "ca"     , TEXTS_ca,    /*  11/ 96 Catalan */
         "cs"     , TEXTS_cs,    /*  17/ 21 Czech */
         "da"     , TEXTS_da,    /*  19/ 54 Danish */
@@ -3867,11 +3884,12 @@
         "kk"     , TEXTS_kk,    /*  15/121 Kazakh */
         "km_KH"  , TEXTS_km_KH, /*   2/122 Khmer (Cambodia) */
         "ky"     , TEXTS_ky,    /*  10/ 89 Kirghiz */
-        "lo_LA"  , TEXTS_lo_LA, /*   2/ 15 Lao (Laos) */
+        "lo_LA"  , TEXTS_lo_LA, /*   2/ 14 Lao (Laos) */
         "lt"     , TEXTS_lt,    /*  18/ 22 Lithuanian */
         "lv"     , TEXTS_lv,    /*  18/ 22 Latvian */
         "mk"     , TEXTS_mk,    /*   9/ 94 Macedonian */
-        "mn_MN"  , TEXTS_mn_MN, /*   2/ 15 Mongolian (Mongolia) */
+        "ml_IN"  , TEXTS_ml_IN, /*   2/ 14 Malayalam (India) */
+        "mn_MN"  , TEXTS_mn_MN, /*   2/ 14 Mongolian (Mongolia) */
         "mr_IN"  , TEXTS_mr_IN, /*  23/ 53 Marathi (India) */
         "my_MM"  , TEXTS_my_MM, /*   8/104 Burmese (Myanmar) */
         "nb"     , TEXTS_nb,    /*  11/ 54 Norwegian Bokmål */
@@ -3888,12 +3906,12 @@
         "sr"     , TEXTS_sr,    /*  11/ 94 Serbian */
         "sv"     , TEXTS_sv,    /*  21/ 54 Swedish */
         "sw"     , TEXTS_sw,    /*   9/ 18 Swahili */
-        "ta_IN"  , TEXTS_ta_IN, /*   2/ 15 Tamil (India) */
-        "th"     , TEXTS_th,    /*   2/ 15 Thai */
+        "ta_IN"  , TEXTS_ta_IN, /*   2/ 14 Tamil (India) */
+        "th"     , TEXTS_th,    /*   2/ 14 Thai */
         "tl"     , TEXTS_tl,    /*   7/  9 Tagalog */
         "tr"     , TEXTS_tr,    /*   7/ 18 Turkish */
         "uk"     , TEXTS_uk,    /*  11/ 88 Ukrainian */
-        "vi"     , TEXTS_vi,    /*   8/ 15 Vietnamese */
+        "vi"     , TEXTS_vi,    /*   8/ 14 Vietnamese */
         "zu"     , TEXTS_zu,    /*   8/ 11 Zulu */
         "zz"     , TEXTS_zz,    /*  19/112 Alphabet */
     };
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java
index 67b8720..056fe1b 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java
@@ -25,7 +25,7 @@
 
 @SmallTest
 public class KeyboardLayoutSetSubtypesCountTests extends KeyboardLayoutSetTestsBase {
-    private static final int NUMBER_OF_SUBTYPES = 74;
+    private static final int NUMBER_OF_SUBTYPES = 75;
     private static final int NUMBER_OF_ASCII_CAPABLE_SUBTYPES = 45;
     private static final int NUMBER_OF_PREDEFINED_ADDITIONAL_SUBTYPES = 2;
 
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Malayalam.java b/tests/src/com/android/inputmethod/keyboard/layout/Malayalam.java
new file mode 100644
index 0000000..b44b888
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Malayalam.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2014 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.keyboard.layout;
+
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
+import com.android.inputmethod.latin.Constants;
+
+import java.util.Locale;
+
+/**
+ * The Malayalam keyboard.
+ */
+public final class Malayalam extends LayoutBase {
+    private static final String LAYOUT_NAME = "malayalam";
+
+    public Malayalam(final LayoutCustomizer customizer) {
+        super(customizer, Symbols.class, SymbolsShifted.class);
+    }
+
+    @Override
+    public String getName() { return LAYOUT_NAME; }
+
+    public static class MalayalamCustomizer extends LayoutCustomizer {
+        public MalayalamCustomizer(final Locale locale) { super(locale); }
+
+        @Override
+        public ExpectedKey getAlphabetKey() { return MALAYALAM_ALPHABET_KEY; }
+
+        @Override
+        public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; }
+
+        @Override
+        public ExpectedKey[] getOtherCurrencyKeys() {
+            return SymbolsShifted.CURRENCIES_OTHER_GENERIC;
+        }
+
+        @Override
+        public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
+            return EMPTY_KEYS;
+        }
+
+        @Override
+        public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
+            return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
+        }
+
+        // U+0D05: "അ" MALAYALAM LETTER A
+        private static final ExpectedKey MALAYALAM_ALPHABET_KEY = key(
+                "\u0D05", Constants.CODE_SWITCH_ALPHA_SYMBOL);
+
+        // U+20B9: "₹" INDIAN RUPEE SIGN
+        private static final ExpectedKey CURRENCY_RUPEE = key("\u20B9",
+                Symbols.CURRENCY_GENERIC_MORE_KEYS);
+    }
+
+    @Override
+    ExpectedKey[][] getCommonAlphabetLayout(boolean isPhone) { return ALPHABET_COMMON; }
+
+    @Override
+    ExpectedKey[][] getCommonAlphabetShiftLayout(boolean isPhone, final int elementId) {
+        return null;
+    }
+
+    private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
+            .setKeysOfRow(1,
+                    // U+0D4D: "്" MALAYALAM SIGN VIRAMA
+                    // U+0D05: "അ" MALAYALAM LETTER A
+                    key("\u0D4D", joinMoreKeys("\u0D05", "1")),
+                    // U+0D3E: "ാ" MALAYALAM VOWEL SIGN AA
+                    // U+0D06: "ആ" MALAYALAM LETTER AA
+                    key("\u0D3E", joinMoreKeys("\u0D06", "2")),
+                    // U+0D3F: "ി" MALAYALAM VOWEL SIGN I
+                    // U+0D07: "ഇ" MALAYALAM LETTER I
+                    key("\u0D3F", joinMoreKeys("\u0D07", "3")),
+                    // U+0D40: "ീ" MALAYALAM VOWEL SIGN II
+                    // U+0D08: "ഈ" MALAYALAM LETTER II
+                    key("\u0D40", joinMoreKeys("\u0D08", "4")),
+                    // U+0D41: "ു" MALAYALAM VOWEL SIGN U
+                    // U+0D09: "ഉ" MALAYALAM LETTER U
+                    key("\u0D41", joinMoreKeys("\u0D09", "5")),
+                    // U+0D42: "ൂ" MALAYALAM VOWEL SIGN UU
+                    // U+0D0A: "ഊ" MALAYALAM LETTER UU
+                    key("\u0D42", joinMoreKeys("\u0D0A", "6")),
+                    // U+0D43: "ൃ" MALAYALAM VOWEL SIGN VOCALIC R
+                    // U+0D0B: "ഋ" MALAYALAM LETTER VOCALIC R
+                    key("\u0D43", joinMoreKeys("\u0D0B", "7")),
+                    // U+0D46: "െ" MALAYALAM VOWEL SIGN E
+                    // U+0D0E: "എ" MALAYALAM LETTER E
+                    // U+0D10: "ഐ" MALAYALAM LETTER AI
+                    // U+0D48: "ൈ" MALAYALAM VOWEL SIGN AI
+                    key("\u0D46", joinMoreKeys("\u0D0E", "\u0D10", "\u0D48", "8")),
+                    // U+0D47: "േ" MALAYALAM VOWEL SIGN EE
+                    // U+0D0F: "ഏ" MALAYALAM LETTER EE
+                    key("\u0D47", joinMoreKeys("\u0D0F", "9")),
+                    // U+0D4A: "ൊ" MALAYALAM VOWEL SIGN O
+                    // U+0D12: "ഒ" MALAYALAM LETTER O
+                    key("\u0D4A", joinMoreKeys("\u0D12", "0")),
+                    // U+0D4B: "ോ" MALAYALAM VOWEL SIGN OO
+                    // U+0D13: "ഓ" MALAYALAM LETTER OO
+                    // U+0D14: "ഔ" MALAYALAM LETTER AU
+                    // U+0D57: "ൗ" MALAYALAM AU LENGTH MARK
+                    key("\u0D4B", joinMoreKeys("\u0D13", "\u0D14", "\u0D57")))
+            .setKeysOfRow(2,
+                    // U+0D15: "ക" MALAYALAM LETTER KA
+                    // U+0D16: "ഖ" MALAYALAM LETTER KHA
+                    key("\u0D15", moreKey("\u0D16")),
+                    // U+0D17: "ഗ" MALAYALAM LETTER GA
+                    // U+0D18: "ഘ" MALAYALAM LETTER GHA
+                    key("\u0D17", moreKey("\u0D18")),
+                    // U+0D19: "ങ" MALAYALAM LETTER NGA
+                    // U+0D1E: "ഞ" MALAYALAM LETTER NYA
+                    key("\u0D19", moreKey("\u0D1E")),
+                    // U+0D1A: "ച" MALAYALAM LETTER CA
+                    // U+0D1B: "ഛ" MALAYALAM LETTER CHA
+                    key("\u0D1A", moreKey("\u0D1B")),
+                    // U+0D1C: "ജ" MALAYALAM LETTER JA
+                    // U+0D1D: "ഝ" MALAYALAM LETTER JHA
+                    key("\u0D1C", moreKey("\u0D1D")),
+                    // U+0D1F: "ട" MALAYALAM LETTER TTA
+                    // U+0D20: "ഠ" MALAYALAM LETTER TTHA
+                    key("\u0D1F", moreKey("\u0D20")),
+                    // U+0D21: "ഡ" MALAYALAM LETTER DDA
+                    // U+0D22: "ഢ" MALAYALAM LETTER DDHA
+                    key("\u0D21", moreKey("\u0D22")),
+                    // U+0D23: "ണ" MALAYALAM LETTER NNA
+                    // U+0D7A: "ൺ" MALAYALAM LETTER CHILLU NN
+                    key("\u0D23", moreKey("\u0D7A")),
+                    // U+0D24: "ത" MALAYALAM LETTER TA
+                    // U+0D25: "ഥ" MALAYALAM LETTER THA
+                    key("\u0D24", moreKey("\u0D25")),
+                    // U+0D26: "ദ" MALAYALAM LETTER DA
+                    // U+0D27: "ധ" MALAYALAM LETTER DHA
+                    key("\u0D26", moreKey("\u0D27")),
+                    // U+0D28: "ഗന" MALAYALAM LETTER NA
+                    // U+0D7B: "ൻ" MALAYALAM LETTER CHILLU N
+                    key("\u0D28", moreKey("\u0D7B")))
+            .setKeysOfRow(3,
+                    // U+0D2A: "പ" MALAYALAM LETTER PA
+                    // U+0D2B: "ഫ" MALAYALAM LETTER PHA
+                    key("\u0D2A", moreKey("\u0D2B")),
+                    // U+0D2C: "ബ" MALAYALAM LETTER BA
+                    // U+0D2D: "ഭ" MALAYALAM LETTER BHA
+                    key("\u0D2C", moreKey("\u0D2D")),
+                    // U+0D2E: "മ" MALAYALAM LETTER MA
+                    // U+0D02: "ം" MALAYALAM SIGN ANUSVARA
+                    key("\u0D2E", moreKey("\u0D02")),
+                    // U+0D2F: "യ" MALAYALAM LETTER YA
+                    // U+0D4D/U+0D2F: "്യ" MALAYALAM SIGN VIRAMA/MALAYALAM LETTER YA
+                    key("\u0D2F", moreKey("\u0D4D\u0D2F")),
+                    // U+0D30: "ര" MALAYALAM LETTER RA
+                    // U+0D4D/U+0D30: "്ര" MALAYALAM SIGN VIRAMA/MALAYALAM LETTER RA
+                    // U+0D7C: "ർ" MALAYALAM LETTER CHILLU RR
+                    // U+0D31: "റ" MALAYALAM LETTER RRA
+                    key("\u0D30", joinMoreKeys("\u0D4D\u0D30", "\u0D7C", "\u0D31")),
+                    // U+0D32: "ല" MALAYALAM LETTER LA
+                    // U+0D7D: "ൽ" MALAYALAM LETTER CHILLU L
+                    key("\u0D32", moreKey("\u0D7D")),
+                    // U+0D35: "വ" MALAYALAM LETTER VA
+                    // U+0D4D/U+0D35: "്വ" MALAYALAM SIGN VIRAMA/MALAYALAM LETTER VA
+                    key("\u0D35", moreKey("\u0D4D\u0D35")),
+                    // U+0D36: "ശ" MALAYALAM LETTER SHA
+                    // U+0D37: "ഷ" MALAYALAM LETTER SSA
+                    // U+0D38: "സ" MALAYALAM LETTER SA
+                    key("\u0D36", joinMoreKeys("\u0D37", "\u0D38")),
+                    // U+0D39: "ഹ" MALAYALAM LETTER HA
+                    // U+0D03: "ഃ" MALAYALAM SIGN VISARGA
+                    key("\u0D39", moreKey("\u0D03")),
+                    // U+0D33: "ള" MALAYALAM LETTER LLA
+                    // U+0D7E: "ൾ" MALAYALAM LETTER CHILLU LL
+                    // U+0D34: "ഴ" MALAYALAM LETTER LLLA
+                    key("\u0D33", joinMoreKeys("\u0D7E", "\u0D34")))
+            .build();
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMalayalamIN.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMalayalamIN.java
new file mode 100644
index 0000000..f937de8
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMalayalamIN.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 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.keyboard.layout.tests;
+
+import android.test.suitebuilder.annotation.SmallTest;
+
+import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.Malayalam;
+import com.android.inputmethod.keyboard.layout.Malayalam.MalayalamCustomizer;
+
+import java.util.Locale;
+
+/**
+ * ta_IN: Malayalam (India)/malayalam
+ */
+@SmallTest
+public final class TestsMalayalamIN extends LayoutTestsBase {
+    private static final Locale LOCALE = new Locale("ml", "IN");
+    private static final LayoutBase LAYOUT = new Malayalam(new MalayalamCustomizer(LOCALE));
+
+    @Override
+    LayoutBase getLayout() { return LAYOUT; }
+}
diff --git a/tools/make-keyboard-text/res/values-ml-rIN/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ml-rIN/donottranslate-more-keys.xml
new file mode 100644
index 0000000..7a2aeed
--- /dev/null
+++ b/tools/make-keyboard-text/res/values-ml-rIN/donottranslate-more-keys.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2014, 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.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Label for "switch to alphabetic" key.
+         U+0D05: "അ" MALAYALAM LETTER A -->
+    <string name="keylabel_to_alpha">&#x0D05;</string>
+    <!-- U+20B9: "₹" INDIAN RUPEE SIGN -->
+    <string name="keyspec_currency">&#x20B9;</string>
+</resources>