diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 80a657346a51f1422c6138cf1f00c61c9c187a78..a18ab766da906431c0e01fe2f52cdab0e026a3d3 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -494,6 +494,11 @@
             <enum name="sinhala" value="10" />
             <enum name="thai" value="11" />
             <enum name="telugu" value="12" />
+            <enum name="devanagari" value="13" />
+            <enum name="bengali" value="14" />
+            <enum name="tamil" value="15" />
+            <enum name="kannada" value="16" />
+            <enum name="malayalam" value="17" />
         </attr>
     </declare-styleable>
 
diff --git a/java/res/xml/keyboard_layout_set_bengali.xml b/java/res/xml/keyboard_layout_set_bengali.xml
index 6e40e6de48c4b921ca4dd502864aa92b31f1eae2..de48a0ceb0a54c1cfb7cb80e5958c2e2966a0a00 100644
--- a/java/res/xml/keyboard_layout_set_bengali.xml
+++ b/java/res/xml/keyboard_layout_set_bengali.xml
@@ -20,6 +20,8 @@
 
 <KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+    <Feature
+        latin:supportedScript="bengali" />
     <Element
         latin:elementName="alphabet"
         latin:elementKeyboard="@xml/kbd_bengali"
diff --git a/java/res/xml/keyboard_layout_set_hindi.xml b/java/res/xml/keyboard_layout_set_hindi.xml
index e850c7ebca629edf1a1d980731e84f8ba83391c7..ee41b2ae796758fbc4fd15d8175a7f62af738b8a 100644
--- a/java/res/xml/keyboard_layout_set_hindi.xml
+++ b/java/res/xml/keyboard_layout_set_hindi.xml
@@ -20,6 +20,8 @@
 
 <KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+    <Feature
+        latin:supportedScript="devanagari" />
     <Element
         latin:elementName="alphabet"
         latin:elementKeyboard="@xml/kbd_hindi"
diff --git a/java/res/xml/keyboard_layout_set_hindi_compact.xml b/java/res/xml/keyboard_layout_set_hindi_compact.xml
index 77d02fbbc8a3733139d5789134d59b2d27715723..147b2993fb7ddeb248dce89dcdfd31970d0c3004 100644
--- a/java/res/xml/keyboard_layout_set_hindi_compact.xml
+++ b/java/res/xml/keyboard_layout_set_hindi_compact.xml
@@ -20,6 +20,8 @@
 
 <KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+    <Feature
+        latin:supportedScript="devanagari" />
     <Element
         latin:elementName="alphabet"
         latin:elementKeyboard="@xml/kbd_hindi_compact"
diff --git a/java/res/xml/keyboard_layout_set_kannada.xml b/java/res/xml/keyboard_layout_set_kannada.xml
index 8dcf996571474dd91cb5acd84d3b2aacf7a79581..14323e7ef0c6e4d31cac49b510aa79cc694f5c0b 100644
--- a/java/res/xml/keyboard_layout_set_kannada.xml
+++ b/java/res/xml/keyboard_layout_set_kannada.xml
@@ -20,6 +20,8 @@
 
 <KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+    <Feature
+        latin:supportedScript="kannada" />
     <Element
         latin:elementName="alphabet"
         latin:elementKeyboard="@xml/kbd_kannada"
diff --git a/java/res/xml/keyboard_layout_set_malayalam.xml b/java/res/xml/keyboard_layout_set_malayalam.xml
index 14c76baf0df5785ae38e6f6662894e153fdcb80d..f6086f6cb957a60a4da30eb2936c4c52e77097ab 100644
--- a/java/res/xml/keyboard_layout_set_malayalam.xml
+++ b/java/res/xml/keyboard_layout_set_malayalam.xml
@@ -20,6 +20,8 @@
 
 <KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+    <Feature
+        latin:supportedScript="malayalam" />
     <Element
         latin:elementName="alphabet"
         latin:elementKeyboard="@xml/kbd_malayalam"
diff --git a/java/res/xml/keyboard_layout_set_marathi.xml b/java/res/xml/keyboard_layout_set_marathi.xml
index e5c68e7ceb415a5b6e08d31d2a2639709e581132..6aea17546d2cb5a46cec9c65fa7df8a504700c99 100644
--- a/java/res/xml/keyboard_layout_set_marathi.xml
+++ b/java/res/xml/keyboard_layout_set_marathi.xml
@@ -20,6 +20,8 @@
 
 <KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+    <Feature
+        latin:supportedScript="devanagari" />
     <Element
         latin:elementName="alphabet"
         latin:elementKeyboard="@xml/kbd_marathi"
diff --git a/java/res/xml/keyboard_layout_set_nepali_romanized.xml b/java/res/xml/keyboard_layout_set_nepali_romanized.xml
index fbbc6a5a088bb5fe602cfc340000fe9bc906b365..5bad83537c54acb887404bd81dee8a6c3c89c609 100644
--- a/java/res/xml/keyboard_layout_set_nepali_romanized.xml
+++ b/java/res/xml/keyboard_layout_set_nepali_romanized.xml
@@ -20,6 +20,8 @@
 
 <KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+    <Feature
+        latin:supportedScript="devanagari" />
     <Element
         latin:elementName="alphabet"
         latin:elementKeyboard="@xml/kbd_nepali_romanized"
diff --git a/java/res/xml/keyboard_layout_set_nepali_traditional.xml b/java/res/xml/keyboard_layout_set_nepali_traditional.xml
index 4a3b6015387436d0b0e0003013e8438fa707c247..6f11dee58b53aff30dc5289cfed93541a12bc20e 100644
--- a/java/res/xml/keyboard_layout_set_nepali_traditional.xml
+++ b/java/res/xml/keyboard_layout_set_nepali_traditional.xml
@@ -20,6 +20,8 @@
 
 <KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+    <Feature
+        latin:supportedScript="devanagari" />
     <Element
         latin:elementName="alphabet"
         latin:elementKeyboard="@xml/kbd_nepali_traditional"
diff --git a/java/res/xml/keyboard_layout_set_tamil.xml b/java/res/xml/keyboard_layout_set_tamil.xml
index 5c0491505f2b2d7c6c7c4582f3afea0e873b6127..27f4a3266e31cde37ed7f35d537746205686cf68 100644
--- a/java/res/xml/keyboard_layout_set_tamil.xml
+++ b/java/res/xml/keyboard_layout_set_tamil.xml
@@ -20,6 +20,8 @@
 
 <KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+    <Feature
+        latin:supportedScript="tamil" />
     <Element
         latin:elementName="alphabet"
         latin:elementKeyboard="@xml/kbd_tamil"
diff --git a/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java b/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java
index f3df63f457fba616684d0b0f92276c27084a84d5..722591c6878d449da5fbb5d39ef6bb7844ed9d4a 100644
--- a/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java
@@ -39,6 +39,11 @@ public class ScriptUtils {
     public static final int SCRIPT_SINHALA = 10;
     public static final int SCRIPT_THAI = 11;
     public static final int SCRIPT_TELUGU = 12;
+    public static final int SCRIPT_DEVANAGARI = 13;
+    public static final int SCRIPT_BENGALI = 14;
+    public static final int SCRIPT_TAMIL = 15;
+    public static final int SCRIPT_KANNADA = 16;
+    public static final int SCRIPT_MALAYALAM = 17;
     public static final TreeMap<String, Integer> mSpellCheckerLanguageToScript;
     static {
         // List of the supported languages and their associated script. We won't check
@@ -102,12 +107,12 @@ public class ScriptUtils {
         case SCRIPT_ARABIC:
             // Arabic letters can be in any of the following blocks:
             // Arabic U+0600..U+06FF
-            // Arabic Supplement U+0750..U+077F
+            // Arabic Supplement, Thaana U+0750..U+077F, U+0780..U+07BF
             // Arabic Extended-A U+08A0..U+08FF
             // Arabic Presentation Forms-A U+FB50..U+FDFF
             // Arabic Presentation Forms-B U+FE70..U+FEFF
             return (codePoint >= 0x600 && codePoint <= 0x6FF)
-                    || (codePoint >= 0x750 && codePoint <= 0x77F)
+                    || (codePoint >= 0x750 && codePoint <= 0x7BF)
                     || (codePoint >= 0x8A0 && codePoint <= 0x8FF)
                     || (codePoint >= 0xFB50 && codePoint <= 0xFDFF)
                     || (codePoint >= 0xFE70 && codePoint <= 0xFEFF);
@@ -153,6 +158,21 @@ public class ScriptUtils {
         case SCRIPT_TELUGU:
             // Telugu unicode block is U+0C00..U+0C7F
             return (codePoint >= 0xC00 && codePoint <= 0xC7F);
+        case SCRIPT_DEVANAGARI:
+            // Devanagari unicode block is +0900..U+097F
+            return (codePoint >= 0x900 && codePoint <= 0x97F);
+        case SCRIPT_BENGALI:
+            // Bengali unicode block is U+0980..U+09FF
+            return (codePoint >= 0x980 && codePoint <= 0x9FF);
+        case SCRIPT_TAMIL:
+            // Tamil unicode block is U+0B80..U+0BFF
+            return (codePoint >= 0xB80 && codePoint <= 0xBFF);
+        case SCRIPT_KANNADA:
+            // Kannada unicode block is U+0C80..U+0CFF
+            return (codePoint >= 0xC80 && codePoint <= 0xCFF);
+        case SCRIPT_MALAYALAM:
+            // Malayalam unicode block is U+0D00..U+0D7F
+            return (codePoint >= 0xD00 && codePoint <= 0xD7F);
         case SCRIPT_UNKNOWN:
             return true;
         default: