Add Kannada keyboard

Bug: 10029252
Change-Id: Ia03ff886f9e62a2fe228fe59b504b033eead7631
diff --git a/java/res/xml-sw600dp/key_space_5kw.xml b/java/res/xml-sw600dp/key_space_5kw.xml
index 71ae5fd..bf7dffb 100644
--- a/java/res/xml-sw600dp/key_space_5kw.xml
+++ b/java/res/xml-sw600dp/key_space_5kw.xml
@@ -22,8 +22,11 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
 >
     <switch>
+        <!-- fa: Perisan
+             kn: Kannada
+             ne: Nepali -->
         <case
-            latin:languageCode="fa|ne"
+            latin:languageCode="fa|kn|ne"
             latin:languageSwitchKeyEnabled="true"
         >
             <Key
@@ -35,7 +38,7 @@
                 latin:keyStyle="zwnjKeyStyle" />
         </case>
         <case
-            latin:languageCode="fa|ne"
+            latin:languageCode="fa|kn|ne"
             latin:languageSwitchKeyEnabled="false"
         >
             <Key
diff --git a/java/res/xml-sw600dp/rows_kannada.xml b/java/res/xml-sw600dp/rows_kannada.xml
new file mode 100644
index 0000000..55eedc5
--- /dev/null
+++ b/java/res/xml-sw600dp/rows_kannada.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_kannada1" />
+        <Key
+            latin:keyStyle="deleteKeyStyle"
+            latin:keyWidth="fillRight" />
+    </Row>
+    <Row
+        latin:keyWidth="8.182%p"
+        latin:keyLabelFlags="fontNormal|autoXScale"
+    >
+        <include latin:keyboardLayout="@xml/rowkeys_kannada2" />
+        <Key
+            latin:keyStyle="enterKeyStyle"
+            latin:keyWidth="fillRight" />
+    </Row>
+    <Row
+        latin:keyWidth="8.182%p"
+        latin:keyLabelFlags="fontNormal|autoXScale"
+    >
+        <include latin:keyboardLayout="@xml/rowkeys_kannada3" />
+        <include latin:keyboardLayout="@xml/keys_exclamation_question" />
+    </Row>
+    <include latin:keyboardLayout="@xml/row_qwerty4" />
+</merge>
diff --git a/java/res/xml/kbd_kannada.xml b/java/res/xml/kbd_kannada.xml
new file mode 100644
index 0000000..0c59228
--- /dev/null
+++ b/java/res/xml/kbd_kannada.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_kannada" />
+</Keyboard>
diff --git a/java/res/xml/key_space_5kw.xml b/java/res/xml/key_space_5kw.xml
index b6d38fb..1b62eab 100644
--- a/java/res/xml/key_space_5kw.xml
+++ b/java/res/xml/key_space_5kw.xml
@@ -22,8 +22,11 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
 >
     <switch>
+        <!-- fa: Perisan
+             kn: Kannada
+             ne: Nepali -->
         <case
-            latin:languageCode="fa|ne"
+            latin:languageCode="fa|kn|ne"
             latin:languageSwitchKeyEnabled="true"
         >
             <Key
@@ -35,7 +38,7 @@
                 latin:keyStyle="zwnjKeyStyle" />
         </case>
         <case
-            latin:languageCode="fa|ne"
+            latin:languageCode="fa|kn|ne"
             latin:languageSwitchKeyEnabled="false"
         >
             <Key
diff --git a/java/res/xml/keyboard_layout_set_kannada.xml b/java/res/xml/keyboard_layout_set_kannada.xml
new file mode 100644
index 0000000..8dcf996
--- /dev/null
+++ b/java/res/xml/keyboard_layout_set_kannada.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_kannada"
+        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 6d4d3f2..2a03f20 100644
--- a/java/res/xml/method.xml
+++ b/java/res/xml/method.xml
@@ -63,6 +63,7 @@
     ka_GE: Georgian (Georgia)/georgian
     kk: Kazakh/east_slavic
     km_KH: Khmer (Cambodia)/khmer
+    (kn_IN: Kannada (India)/kannada) # This is a preliminary keyboard layout.
     ky: Kyrgyz/east_slavic
     lo_LA: Lao (Laos)/lao
     lt: Lithuanian/qwerty
@@ -444,6 +445,16 @@
             android:imeSubtypeExtraValue="KeyboardLayoutSet=khmer,EmojiCapable"
             android:isAsciiCapable="false"
     />
+    <!-- TODO: This kannada 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="0x8c78064f"
+            android:imeSubtypeLocale="kn_IN"
+            android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=kannada,EmojiCapable"
+            android:isAsciiCapable="false"
+    />
     <subtype android:icon="@drawable/ic_ime_switcher_dark"
             android:label="@string/subtype_generic"
             android:subtypeId="0x2e391c04"
diff --git a/java/res/xml/rowkeys_kannada1.xml b/java/res/xml/rowkeys_kannada1.xml
new file mode 100644
index 0000000..e7aecd8
--- /dev/null
+++ b/java/res/xml/rowkeys_kannada1.xml
@@ -0,0 +1,107 @@
+<?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+0CCC: "ೌ" KANNADA VOWEL SIGN AU
+         U+0C94: "ಔ" KANNADA LETTER AU
+         U+0CE7: "೧" KANNADA DIGIT ONE -->
+    <Key
+        latin:keySpec="&#x0CCC;"
+        latin:moreKeys="&#x0C94;,&#x0CE7;,%"
+        latin:keyHintLabel="1"
+        latin:additionalMoreKeys="1" />
+    <!-- U+0CC8: "ೈ" KANNADA VOWEL SIGN AI
+         U+0C90: "ಐ" KANNADA LETTER AI
+         U+0CE8: "೨" KANNADA DIGIT TWO -->
+    <Key
+        latin:keySpec="&#x0CC8;"
+        latin:moreKeys="&#x0C90;,&#x0CE8;,%"
+        latin:keyHintLabel="2"
+        latin:additionalMoreKeys="2" />
+    <!-- U+0CBE: "ಾ" KANNADA VOWEL SIGN AA
+         U+0C86: "ಆ" KANNADA LETTER AA
+         U+0CE9: "೩" KANNADA DIGIT THREE -->
+    <Key
+        latin:keySpec="&#x0CBE;"
+        latin:moreKeys="&#x0C86;,&#x0CE9;,%"
+        latin:keyHintLabel="3"
+        latin:additionalMoreKeys="3" />
+    <!-- U+0CC0: "ೀ" KANNADA VOWEL SIGN II
+         U+0C88: "ಈ" KANNADA LETTER II
+         U+0CEA: "೪" KANNADA DIGIT FOUR -->
+    <Key
+        latin:keySpec="&#x0CC0;"
+        latin:moreKeys="&#x0C88;,&#x0CEA;,%"
+        latin:keyHintLabel="4"
+        latin:additionalMoreKeys="4" />
+    <!-- U+0CC2: "ೂ" KANNADA VOWEL SIGN UU
+         U+0C8A: "ಊ" KANNADA LETTER UU
+         U+0CEB: "೫" KANNADA DIGIT FIVE -->
+    <Key
+        latin:keySpec="&#x0CC2;"
+        latin:moreKeys="&#x0C8A;,&#x0CEB;,%"
+        latin:keyHintLabel="5"
+        latin:additionalMoreKeys="5" />
+    <!-- U+0CAC: "ಬ" KANNADA LETTER BA
+         U+0CAD: "ಭ" KANNADA LETTER BHA
+         U+0CEC: "೬" KANNADA DIGIT SIX -->
+    <Key
+        latin:keySpec="&#x0CAC;"
+        latin:moreKeys="&#x0CAD;,&#x0CEC;,%"
+        latin:keyHintLabel="6"
+        latin:additionalMoreKeys="6" />
+    <!-- U+0CB9: "ಹ" KANNADA LETTER HA
+         U+0C99: "ಙ" KANNADA LETTER NGA
+         U+0CED: "೭" KANNADA DIGIT SEVEN -->
+    <Key
+        latin:keySpec="&#x0CB9;"
+        latin:moreKeys="&#x0C99;,&#x0CED;,%"
+        latin:keyHintLabel="7"
+        latin:additionalMoreKeys="7" />
+    <!-- U+0C97: "ಗ" KANNADA LETTER GA
+         U+0C98: "ಘ" KANNADA LETTER GHA
+         U+0CEE: "೮" KANNADA DIGIT EIGHT -->
+    <Key
+        latin:keySpec="&#x0C97;"
+        latin:moreKeys="&#x0C98;,&#x0CEE;,%"
+        latin:keyHintLabel="8"
+        latin:additionalMoreKeys="8" />
+    <!-- U+0CA6: "ದ" KANNADA LETTER DA
+         U+0CA7: "ಧ" KANNADA LETTER DHA
+         U+0CEF: "೯" KANNADA DIGIT NINE -->
+    <Key
+        latin:keySpec="&#x0CA6;"
+        latin:moreKeys="&#x0CA7;,&#x0CEF;,%"
+        latin:keyHintLabel="9"
+        latin:additionalMoreKeys="9" />
+    <!-- U+0C9C: "ಜ" KANNADA LETTER JA
+         U+0C9D: "ಝ" KANNADA LETTER JHA
+         U+0CE6: "೦" KANNADA DIGIT ZERO -->
+    <Key
+        latin:keySpec="&#x0C9C;"
+        latin:moreKeys="&#x0C9D;,&#x0CE6;,%"
+        latin:keyHintLabel="0"
+        latin:additionalMoreKeys="0" />
+    <!-- U+0CA1: "ಡ" KANNADA LETTER DDA
+         U+0CA2: "ಢ" KANNADA LETTER DDHA -->
+    <Key
+        latin:keySpec="&#x0CA1;"
+        latin:moreKeys="&#x0CA2;" />
+</merge>
diff --git a/java/res/xml/rowkeys_kannada2.xml b/java/res/xml/rowkeys_kannada2.xml
new file mode 100644
index 0000000..f3e6c18
--- /dev/null
+++ b/java/res/xml/rowkeys_kannada2.xml
@@ -0,0 +1,78 @@
+<?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+0CCB: "ೋ" KANNADA VOWEL SIGN OO
+         U+0C93: "ಓ" KANNADA LETTER OO -->
+    <Key
+        latin:keySpec="&#x0CCB;"
+        latin:moreKeys="&#x0C93;" />
+    <!-- U+0CC7: "ೇ" KANNADA VOWEL SIGN EE
+         U+0C8F: "ಏ" KANNADA LETTER EE -->
+    <Key
+        latin:keySpec="&#x0CC7;"
+        latin:moreKeys="&#x0C8F;" />
+    <!-- U+0CCD: "್" KANNADA SIGN VIRAMA
+         U+0C85: "ಅ" KANNADA LETTER A -->
+    <Key
+        latin:keySpec="&#x0CCD;"
+        latin:moreKeys="&#x0C85;" />
+    <!-- U+0CBF: "ಿ" KANNADA VOWEL SIGN I
+         U+0C87: "ಇ" KANNADA LETTER I -->
+    <Key
+        latin:keySpec="&#x0CBF;"
+        latin:moreKeys="&#x0C87;" />
+    <!-- U+0CC1: "ು" KANNADA VOWEL SIGN U
+         U+0C89: "ಉ" KANNADA LETTER U -->
+    <Key
+        latin:keySpec="&#x0CC1;"
+        latin:moreKeys="&#x0C89;" />
+    <!-- U+0CAA: "ಪ" KANNADA LETTER PA
+         U+0CAB: "ಫ" KANNADA LETTER PHA -->
+    <Key
+        latin:keySpec="&#x0CAA;"
+        latin:moreKeys="&#x0CAB;" />
+    <!-- U+0CB0: "ರ" KANNADA LETTER RA
+         U+0CB1: "ಱ" KANNADA LETTER RRA
+         U+0CC3: "ೃ" KANNADA VOWEL SIGN VOCALIC R -->
+    <Key
+        latin:keySpec="&#x0CB0;"
+        latin:moreKeys="&#x0CB1;,&#x0CC3;" />
+    <!-- U+0C95: "ಕ" KANNADA LETTER KA
+         U+0C96: "ಖ" KANNADA LETTER KHA -->
+    <Key
+        latin:keySpec="&#x0C95;"
+        latin:moreKeys="&#x0C96;" />
+    <!-- U+0CA4: "ತ" KANNADA LETTER TA
+         U+0CA5: "ಥ" KANNADA LETTER THA -->
+    <Key
+        latin:keySpec="&#x0CA4;"
+        latin:moreKeys="&#x0CA5;" />
+    <!-- U+0C9A: "ಚ" KANNADA LETTER CA
+         U+0C9B: "ಛ" KANNADA LETTER CHA -->
+    <Key
+        latin:keySpec="&#x0C9A;"
+        latin:moreKeys="&#x0C9B;" />
+    <!-- U+0C9F: "ಟ" KANNADA LETTER TTA
+         U+0CA0: "ಠ" KANNADA LETTER TTHA -->
+    <Key
+        latin:keySpec="&#x0C9F;"
+        latin:moreKeys="&#x0CA0;" />
+</merge>
diff --git a/java/res/xml/rowkeys_kannada3.xml b/java/res/xml/rowkeys_kannada3.xml
new file mode 100644
index 0000000..0f1aecb
--- /dev/null
+++ b/java/res/xml/rowkeys_kannada3.xml
@@ -0,0 +1,66 @@
+<?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+0CC6: "ೆ" KANNADA VOWEL SIGN E
+         U+0C92: "ಒ" KANNADA LETTER O -->
+    <Key
+        latin:keySpec="&#x0CC6;"
+        latin:moreKeys="&#x0C92;" />
+    <!-- U+0C82: "ಂ" KANNADA SIGN ANUSVARA
+         U+0C8E: "ಎ" KANNADA LETTER E -->
+    <Key
+        latin:keySpec="&#x0C82;"
+        latin:moreKeys="&#x0C8E;" />
+    <!-- U+0CAE: "ಮ" KANNADA LETTER MA
+         U+0CA3: "ಣ" KANNADA LETTER NNA -->
+    <Key
+        latin:keySpec="&#x0CAE;"
+        latin:moreKeys="&#x0CA3;" />
+    <!-- U+0CA8: "ನ" KANNADA LETTER NA -->
+    <Key latin:keySpec="&#x0CA8;" />
+    <!-- U+0CB5: "ವ" KANNADA LETTER VA -->
+    <Key latin:keySpec="&#x0CB5;" />
+    <!-- U+0CB2: "ಲ" KANNADA LETTER LA
+         U+0CB3: "ಳ" KANNADA LETTER LLA -->
+    <Key
+        latin:keySpec="&#x0CB2;"
+        latin:moreKeys="&#x0CB3;" />
+    <!-- U+0CB8: "ಸ" KANNADA LETTER SA
+         U+0CB6: "ಶ" KANNADA LETTER SHA -->
+    <Key
+        latin:keySpec="&#x0CB8;"
+        latin:moreKeys="&#x0CB6;" />
+    <!-- U+0C8B: "ಋ" KANNADA LETTER VOCALIC R
+         U+0CCD/U+0CB0: "್ರ" KANNADA SIGN VIRAMA/KANNADA LETTER RA -->
+    <Key
+        latin:keySpec="&#x0C8B;"
+        latin:moreKeys="&#x0CCD;&#x0CB0;" />
+    <!-- U+0CB7: "ಷ" KANNADA LETTER SSA
+         U+0C95/U+0CCD/U+0CB7: "ಕ್ಷ" KANNADA LETTER RA/KANNADA SIGN VIRAMA/KANNADA LETTER SSA -->
+    <Key
+        latin:keySpec="&#x0CB7;"
+        latin:moreKeys="&#x0C95;&#x0CCD;&#x0CB7;" />
+    <!-- U+0CAF: "ಯ" KANNADA LETTER YA
+         U+0C9C/U+0CCD/U+0C9E: "ಜ್ಞ" KANNADA LETTER JA/KANNADA SIGN VIRAMA/KANNADA LETTER NYA -->
+    <Key
+        latin:keySpec="&#x0CAF;"
+        latin:moreKeys="&#x0C9C;&#x0CCD;&#x0C9E;" />
+</merge>
diff --git a/java/res/xml/rows_kannada.xml b/java/res/xml/rows_kannada.xml
new file mode 100644
index 0000000..5dc6271
--- /dev/null
+++ b/java/res/xml/rows_kannada.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_kannada1" />
+    </Row>
+    <Row
+        latin:keyWidth="9.091%p"
+        latin:keyLabelFlags="fontNormal|autoXScale"
+    >
+        <include latin:keyboardLayout="@xml/rowkeys_kannada2" />
+    </Row>
+    <Row
+        latin:keyWidth="9.091%p"
+        latin:keyLabelFlags="fontNormal|autoXScale"
+    >
+        <include latin:keyboardLayout="@xml/rowkeys_kannada3" />
+        <Key
+            latin:keyStyle="deleteKeyStyle"
+            latin:keyWidth="fillRight" />
+    </Row>
+    <include latin:keyboardLayout="@xml/row_qwerty4" />
+</merge>
\ No newline at end of file