diff --git a/java/proguard.flags b/java/proguard.flags
index 2ee1a263f22dcecede43f844cdd61041555677fc..44f8581ccfeda61312c2d5dabc73df6a16a104ef 100644
--- a/java/proguard.flags
+++ b/java/proguard.flags
@@ -40,7 +40,7 @@
   void setLogFileManager(...);
 }
 
--keep class com.android.inputmethod.keyboard.KeyboardSet$Builder {
+-keep class com.android.inputmethod.keyboard.KeyboardLayoutSet$Builder {
   void setTouchPositionCorrectionEnabled(...);
 }
 
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 86f2abe723c8408657d3765ad232f5124b066dad..39d50e34849502ad77c0f70497a815878bf854ad 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -350,8 +350,8 @@
     </declare-styleable>
 
     <declare-styleable name="Keyboard_Case">
-        <!-- This should be aligned with KeyboardSet_Element's elementName. -->
-        <attr name="keyboardSetElement" format="enum|string">
+        <!-- This should be aligned with KeyboardLayoutSet_Element's elementName. -->
+        <attr name="keyboardLayoutSetElement" format="enum|string">
             <enum name="alphabet" value="0" />
             <enum name="alphabetManualShifted" value="1" />
             <enum name="alphabetAutomaticShifted" value="2" />
@@ -403,7 +403,7 @@
         <attr name="parentStyle" format="string" />
     </declare-styleable>
 
-    <declare-styleable name="KeyboardSet_Element">
+    <declare-styleable name="KeyboardLayoutSet_Element">
         <!-- This should be aligned with KeyboardId.ELEMENT_* -->
         <attr name="elementName" format="enum">
             <enum name="alphabet" value="0" />
diff --git a/java/res/xml-ar/keyboard_set.xml b/java/res/xml-ar/keyboard_set.xml
deleted file mode 100644
index 88d320144604afea07ccca529605529e8a21cc9d..0000000000000000000000000000000000000000
--- a/java/res/xml-ar/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_arabic"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-be/keyboard_set.xml b/java/res/xml-be/keyboard_set.xml
deleted file mode 100644
index 959f644ea65f0c390933995e77e7c7bcc1a71915..0000000000000000000000000000000000000000
--- a/java/res/xml-be/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_east_slavic"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-cs/keyboard_set.xml b/java/res/xml-cs/keyboard_set.xml
deleted file mode 100644
index f9f74516fdff74ad7cf4e63f2fc2eae8e57affc6..0000000000000000000000000000000000000000
--- a/java/res/xml-cs/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwertz"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-da/keyboard_set.xml b/java/res/xml-da/keyboard_set.xml
deleted file mode 100644
index 0db9b1f591748c28e99bb8db42bd01d10c0c3656..0000000000000000000000000000000000000000
--- a/java/res/xml-da/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_nordic"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-de-rQY/keyboard_set.xml b/java/res/xml-de-rQY/keyboard_set.xml
deleted file mode 100644
index 8966ddbb05c1466cc84f3629d879f5b63fbac44c..0000000000000000000000000000000000000000
--- a/java/res/xml-de-rQY/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwerty"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-de/keyboard_set.xml b/java/res/xml-de/keyboard_set.xml
deleted file mode 100644
index f9f74516fdff74ad7cf4e63f2fc2eae8e57affc6..0000000000000000000000000000000000000000
--- a/java/res/xml-de/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwertz"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-et/keyboard_set.xml b/java/res/xml-et/keyboard_set.xml
deleted file mode 100644
index 0db9b1f591748c28e99bb8db42bd01d10c0c3656..0000000000000000000000000000000000000000
--- a/java/res/xml-et/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_nordic"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-fi/keyboard_set.xml b/java/res/xml-fi/keyboard_set.xml
deleted file mode 100644
index 0db9b1f591748c28e99bb8db42bd01d10c0c3656..0000000000000000000000000000000000000000
--- a/java/res/xml-fi/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_nordic"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-fr-rCA/keyboard_set.xml b/java/res/xml-fr-rCA/keyboard_set.xml
deleted file mode 100644
index 8966ddbb05c1466cc84f3629d879f5b63fbac44c..0000000000000000000000000000000000000000
--- a/java/res/xml-fr-rCA/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwerty"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-fr-rCH/keyboard_set.xml b/java/res/xml-fr-rCH/keyboard_set.xml
deleted file mode 100644
index f9f74516fdff74ad7cf4e63f2fc2eae8e57affc6..0000000000000000000000000000000000000000
--- a/java/res/xml-fr-rCH/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwertz"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-hr/keyboard_set.xml b/java/res/xml-hr/keyboard_set.xml
deleted file mode 100644
index f9f74516fdff74ad7cf4e63f2fc2eae8e57affc6..0000000000000000000000000000000000000000
--- a/java/res/xml-hr/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwertz"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-hu/keyboard_set.xml b/java/res/xml-hu/keyboard_set.xml
deleted file mode 100644
index f9f74516fdff74ad7cf4e63f2fc2eae8e57affc6..0000000000000000000000000000000000000000
--- a/java/res/xml-hu/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwertz"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-nb/keyboard_set.xml b/java/res/xml-nb/keyboard_set.xml
deleted file mode 100644
index 0db9b1f591748c28e99bb8db42bd01d10c0c3656..0000000000000000000000000000000000000000
--- a/java/res/xml-nb/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_nordic"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-pl/keyboard_set.xml b/java/res/xml-pl/keyboard_set.xml
deleted file mode 100644
index 8966ddbb05c1466cc84f3629d879f5b63fbac44c..0000000000000000000000000000000000000000
--- a/java/res/xml-pl/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwerty"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-pt/keyboard_set.xml b/java/res/xml-pt/keyboard_set.xml
deleted file mode 100644
index 8966ddbb05c1466cc84f3629d879f5b63fbac44c..0000000000000000000000000000000000000000
--- a/java/res/xml-pt/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwerty"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-ro/keyboard_set.xml b/java/res/xml-ro/keyboard_set.xml
deleted file mode 100644
index 8966ddbb05c1466cc84f3629d879f5b63fbac44c..0000000000000000000000000000000000000000
--- a/java/res/xml-ro/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwerty"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-ru/keyboard_set.xml b/java/res/xml-ru/keyboard_set.xml
deleted file mode 100644
index 959f644ea65f0c390933995e77e7c7bcc1a71915..0000000000000000000000000000000000000000
--- a/java/res/xml-ru/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_east_slavic"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-sk/keyboard_set.xml b/java/res/xml-sk/keyboard_set.xml
deleted file mode 100644
index 8966ddbb05c1466cc84f3629d879f5b63fbac44c..0000000000000000000000000000000000000000
--- a/java/res/xml-sk/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwerty"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-sl/keyboard_set.xml b/java/res/xml-sl/keyboard_set.xml
deleted file mode 100644
index 8966ddbb05c1466cc84f3629d879f5b63fbac44c..0000000000000000000000000000000000000000
--- a/java/res/xml-sl/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwerty"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-sr/keyboard_set.xml b/java/res/xml-sr/keyboard_set.xml
deleted file mode 100644
index 5098134a7dd4d54f9a24ae4e9a7a675230d87e81..0000000000000000000000000000000000000000
--- a/java/res/xml-sr/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_south_slavic"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-sv/keyboard_set.xml b/java/res/xml-sv/keyboard_set.xml
deleted file mode 100644
index 0db9b1f591748c28e99bb8db42bd01d10c0c3656..0000000000000000000000000000000000000000
--- a/java/res/xml-sv/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_nordic"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-sw600dp/key_styles_common.xml b/java/res/xml-sw600dp/key_styles_common.xml
index 77c0efd22102d8adc432594289a085e27ef10e31..45e22fce3d4c6844702ee813ebab81d755a79aff 100644
--- a/java/res/xml-sw600dp/key_styles_common.xml
+++ b/java/res/xml-sw600dp/key_styles_common.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLockShifted"
         >
             <key-style
                 latin:styleName="hasShiftedLetterHintStyle"
@@ -38,7 +38,7 @@
     <!-- Functional key styles -->
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetAutomaticShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetAutomaticShifted"
         >
             <key-style
                 latin:styleName="shiftKeyStyle"
@@ -48,7 +48,7 @@
                 latin:backgroundType="stickyOff" />
         </case>
         <case
-            latin:keyboardSetElement="alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <key-style
                 latin:styleName="shiftKeyStyle"
@@ -109,7 +109,7 @@
         latin:backgroundType="functional" />
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLockShifted"
             latin:navigatePrevious="true"
         >
             <key-style
diff --git a/java/res/xml-sw600dp/rowkeys_thai1.xml b/java/res/xml-sw600dp/rowkeys_thai1.xml
index e49cb2b476ce0c1d28a6807c3aae2e7cd6fb66b4..6aec7c2c5d1bed7fed095515e68365ece4462db2 100644
--- a/java/res/xml-sw600dp/rowkeys_thai1.xml
+++ b/java/res/xml-sw600dp/rowkeys_thai1.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <!-- U+0E51: "๑" THAI DIGIT ONE -->
             <Key
diff --git a/java/res/xml-sw600dp/rowkeys_thai2.xml b/java/res/xml-sw600dp/rowkeys_thai2.xml
index 86a219854178164a6ae62e57c4d86574535975ad..edb759a89c95d759c14f3923df2e5efc76e30fd9 100644
--- a/java/res/xml-sw600dp/rowkeys_thai2.xml
+++ b/java/res/xml-sw600dp/rowkeys_thai2.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <!-- U+0E50: "๐" THAI DIGIT ZERO -->
             <Key
diff --git a/java/res/xml-sw600dp/rowkeys_thai3.xml b/java/res/xml-sw600dp/rowkeys_thai3.xml
index abd67631c7442fc499fb941e47ade653a5b61d67..7507dde86e50bec4c85df4f226b5143b1dd4e657 100644
--- a/java/res/xml-sw600dp/rowkeys_thai3.xml
+++ b/java/res/xml-sw600dp/rowkeys_thai3.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <!-- U+0E24: "ฤ" THAI CHARACTER RU -->
             <Key
diff --git a/java/res/xml-sw600dp/rowkeys_thai4.xml b/java/res/xml-sw600dp/rowkeys_thai4.xml
index cec34a63b6f8ac050dcefbe30175d07026687c04..64549bdce5ac909f49dfcb8a20416a6ea0b7a5b0 100644
--- a/java/res/xml-sw600dp/rowkeys_thai4.xml
+++ b/java/res/xml-sw600dp/rowkeys_thai4.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <Key
                 latin:keyLabel="(" />
diff --git a/java/res/xml-sw768dp/key_styles_common.xml b/java/res/xml-sw768dp/key_styles_common.xml
index f4a1a4ea529a9d7ecc98f8732e49db3fa6eafe49..e1c236912a23076637b6d8ff939a8c541bf5f835 100644
--- a/java/res/xml-sw768dp/key_styles_common.xml
+++ b/java/res/xml-sw768dp/key_styles_common.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLockShifted"
         >
             <key-style
                 latin:styleName="hasShiftedLetterHintStyle"
@@ -37,7 +37,7 @@
     </switch>
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetAutomaticShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetAutomaticShifted"
         >
             <key-style
                 latin:styleName="shiftKeyStyle"
@@ -47,7 +47,7 @@
                 latin:backgroundType="stickyOff" />
         </case>
         <case
-            latin:keyboardSetElement="alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <key-style
                 latin:styleName="shiftKeyStyle"
@@ -108,7 +108,7 @@
         latin:backgroundType="functional" />
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLockShifted"
             latin:navigatePrevious="true"
         >
             <key-style
diff --git a/java/res/xml-tr/keyboard_set.xml b/java/res/xml-tr/keyboard_set.xml
deleted file mode 100644
index 8966ddbb05c1466cc84f3629d879f5b63fbac44c..0000000000000000000000000000000000000000
--- a/java/res/xml-tr/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwerty"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-uk/keyboard_set.xml b/java/res/xml-uk/keyboard_set.xml
deleted file mode 100644
index 959f644ea65f0c390933995e77e7c7bcc1a71915..0000000000000000000000000000000000000000
--- a/java/res/xml-uk/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_east_slavic"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml-vi/keyboard_set.xml b/java/res/xml-vi/keyboard_set.xml
deleted file mode 100644
index 8966ddbb05c1466cc84f3629d879f5b63fbac44c..0000000000000000000000000000000000000000
--- a/java/res/xml-vi/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwerty"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml/key_azerty_quote.xml b/java/res/xml/key_azerty_quote.xml
index 8c44f7862b9dd0eb6e43cc882191cc89385c164b..966ae6f21989776eb5c59f508ffff7e3649dbf12 100644
--- a/java/res/xml/key_azerty_quote.xml
+++ b/java/res/xml/key_azerty_quote.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLockShifted"
         >
             <Key
                 latin:keyLabel="\?" />
diff --git a/java/res/xml/key_greek_semicolon.xml b/java/res/xml/key_greek_semicolon.xml
index a28b772fdd91be7d6407540af0c270ebf174857b..ae73a59f62e39d80deb8c32e591a111c756f5be1 100644
--- a/java/res/xml/key_greek_semicolon.xml
+++ b/java/res/xml/key_greek_semicolon.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLockShifted"
         >
             <Key
                 latin:keyLabel=":"
diff --git a/java/res/xml/key_styles_common.xml b/java/res/xml/key_styles_common.xml
index d5a9a2629e746685411f30d1826a10b92cd933e3..8d01091d6c8211e84bb171569b7b6cfa4ae290c8 100644
--- a/java/res/xml/key_styles_common.xml
+++ b/java/res/xml/key_styles_common.xml
@@ -42,7 +42,7 @@
     <!-- Functional key styles -->
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetAutomaticShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetAutomaticShifted"
         >
             <key-style
                 latin:styleName="shiftKeyStyle"
@@ -52,7 +52,7 @@
                 latin:backgroundType="stickyOff" />
         </case>
         <case
-            latin:keyboardSetElement="alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <key-style
                 latin:styleName="shiftKeyStyle"
@@ -82,7 +82,7 @@
         <!-- Shift + Enter in textMultiLine field. -->
         <case
             latin:isMultiLine="true"
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLockShifted"
         >
             <key-style
                 latin:styleName="enterKeyStyle"
diff --git a/java/res/xml/key_styles_enter.xml b/java/res/xml/key_styles_enter.xml
index a4c9a3396eef7542ed62de23e6f721186b653f1e..e15a0bec7798271e8cd5b5fdcd7142242442d7b4 100644
--- a/java/res/xml/key_styles_enter.xml
+++ b/java/res/xml/key_styles_enter.xml
@@ -108,7 +108,7 @@
         <!-- Shift + Enter in textMultiLine field. -->
         <case
             latin:isMultiLine="true"
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLockShifted"
         >
             <key-style
                 latin:styleName="enterKeyStyle"
diff --git a/java/res/xml/keyboard_layout_set_arabic.xml b/java/res/xml/keyboard_layout_set_arabic.xml
new file mode 100644
index 0000000000000000000000000000000000000000..10e95bd30d7307a89858da141354d5a2b2bf2e13
--- /dev/null
+++ b/java/res/xml/keyboard_layout_set_arabic.xml
@@ -0,0 +1,42 @@
+<?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.
+*/
+-->
+
+<KeyboardLayoutSet
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+    <Element
+        latin:elementName="alphabet"
+        latin:elementKeyboard="@xml/kbd_arabic"
+        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-fr/keyboard_set.xml b/java/res/xml/keyboard_layout_set_azerty.xml
similarity index 93%
rename from java/res/xml-fr/keyboard_set.xml
rename to java/res/xml/keyboard_layout_set_azerty.xml
index 2ac25c91d5f2db94a6baaa05e384dc99e9cbaace..d4df6676c46227b954c1d70b6d0bc675886cfffb 100644
--- a/java/res/xml-fr/keyboard_set.xml
+++ b/java/res/xml/keyboard_layout_set_azerty.xml
@@ -2,7 +2,7 @@
 <!--
 /*
 **
-** Copyright 2011, The Android Open Source Project
+** 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.
@@ -18,7 +18,7 @@
 */
 -->
 
-<KeyboardSet
+<KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
     <Element
         latin:elementName="alphabet"
@@ -39,4 +39,4 @@
     <Element
         latin:elementName="number"
         latin:elementKeyboard="@xml/kbd_number" />
-</KeyboardSet>
+</KeyboardLayoutSet>
diff --git a/java/res/xml-bg/keyboard_set.xml b/java/res/xml/keyboard_layout_set_bulgarian.xml
similarity index 97%
rename from java/res/xml-bg/keyboard_set.xml
rename to java/res/xml/keyboard_layout_set_bulgarian.xml
index 593ad977c87a8f4401432f08a33308b8da1b134a..c6fdff9a23a7da4715f263f321ccb4afad6509ac 100644
--- a/java/res/xml-bg/keyboard_set.xml
+++ b/java/res/xml/keyboard_layout_set_bulgarian.xml
@@ -18,7 +18,7 @@
 */
 -->
 
-<KeyboardSet
+<KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
     <Element
         latin:elementName="alphabet"
@@ -39,4 +39,4 @@
     <Element
         latin:elementName="number"
         latin:elementKeyboard="@xml/kbd_number" />
-</KeyboardSet>
+</KeyboardLayoutSet>
diff --git a/java/res/xml-ky/keyboard_set.xml b/java/res/xml/keyboard_layout_set_east_slavic.xml
similarity index 93%
rename from java/res/xml-ky/keyboard_set.xml
rename to java/res/xml/keyboard_layout_set_east_slavic.xml
index 959f644ea65f0c390933995e77e7c7bcc1a71915..8d66faf8f6e942eff1841d4ec6dd9938f7ca06ae 100644
--- a/java/res/xml-ky/keyboard_set.xml
+++ b/java/res/xml/keyboard_layout_set_east_slavic.xml
@@ -2,7 +2,7 @@
 <!--
 /*
 **
-** Copyright 2011, The Android Open Source Project
+** 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.
@@ -18,7 +18,7 @@
 */
 -->
 
-<KeyboardSet
+<KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
     <Element
         latin:elementName="alphabet"
@@ -39,4 +39,4 @@
     <Element
         latin:elementName="number"
         latin:elementKeyboard="@xml/kbd_number" />
-</KeyboardSet>
+</KeyboardLayoutSet>
diff --git a/java/res/xml-fa/keyboard_set.xml b/java/res/xml/keyboard_layout_set_farsi.xml
similarity index 97%
rename from java/res/xml-fa/keyboard_set.xml
rename to java/res/xml/keyboard_layout_set_farsi.xml
index f508f8f29414fdeeccea64286d72a793a4ae1d66..b9a91e3a895a0de6ebb1b6a0a8aeadaeee747a0f 100644
--- a/java/res/xml-fa/keyboard_set.xml
+++ b/java/res/xml/keyboard_layout_set_farsi.xml
@@ -18,7 +18,7 @@
 */
 -->
 
-<KeyboardSet
+<KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
     <Element
         latin:elementName="alphabet"
@@ -39,4 +39,4 @@
     <Element
         latin:elementName="number"
         latin:elementKeyboard="@xml/kbd_number" />
-</KeyboardSet>
+</KeyboardLayoutSet>
diff --git a/java/res/xml-ka/keyboard_set.xml b/java/res/xml/keyboard_layout_set_georgian.xml
similarity index 98%
rename from java/res/xml-ka/keyboard_set.xml
rename to java/res/xml/keyboard_layout_set_georgian.xml
index bc3df1ed0ef0512c59b6025f86b777d4488e27c6..36d091653000a2aec79c40a902a9dbf4ffee84b7 100644
--- a/java/res/xml-ka/keyboard_set.xml
+++ b/java/res/xml/keyboard_layout_set_georgian.xml
@@ -18,7 +18,7 @@
 */
 -->
 
-<KeyboardSet
+<KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
     <Element
         latin:elementName="alphabet"
@@ -55,4 +55,4 @@
     <Element
         latin:elementName="number"
         latin:elementKeyboard="@xml/kbd_number" />
-</KeyboardSet>
+</KeyboardLayoutSet>
diff --git a/java/res/xml-el/keyboard_set.xml b/java/res/xml/keyboard_layout_set_greek.xml
similarity index 97%
rename from java/res/xml-el/keyboard_set.xml
rename to java/res/xml/keyboard_layout_set_greek.xml
index af74e12c55de22cd2f2c2b33a3f1553e4eef96b2..b376e4fe3ab9502a63ef622480925a226c2efdb2 100644
--- a/java/res/xml-el/keyboard_set.xml
+++ b/java/res/xml/keyboard_layout_set_greek.xml
@@ -18,7 +18,7 @@
 */
 -->
 
-<KeyboardSet
+<KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
     <Element
         latin:elementName="alphabet"
@@ -39,4 +39,4 @@
     <Element
         latin:elementName="number"
         latin:elementKeyboard="@xml/kbd_number" />
-</KeyboardSet>
+</KeyboardLayoutSet>
diff --git a/java/res/xml-iw/keyboard_set.xml b/java/res/xml/keyboard_layout_set_hebrew.xml
similarity index 93%
rename from java/res/xml-iw/keyboard_set.xml
rename to java/res/xml/keyboard_layout_set_hebrew.xml
index 6c51fb085bcb85929c19971a7a965a06000fbb4a..d0f12f3ee3ee0611d800a60c8edd4786d98fd701 100644
--- a/java/res/xml-iw/keyboard_set.xml
+++ b/java/res/xml/keyboard_layout_set_hebrew.xml
@@ -2,7 +2,7 @@
 <!--
 /*
 **
-** Copyright 2011, The Android Open Source Project
+** 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.
@@ -18,7 +18,7 @@
 */
 -->
 
-<KeyboardSet
+<KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
     <Element
         latin:elementName="alphabet"
@@ -39,4 +39,4 @@
     <Element
         latin:elementName="number"
         latin:elementKeyboard="@xml/kbd_number" />
-</KeyboardSet>
+</KeyboardLayoutSet>
diff --git a/java/res/xml-hi/keyboard_set.xml b/java/res/xml/keyboard_layout_set_hindi.xml
similarity index 98%
rename from java/res/xml-hi/keyboard_set.xml
rename to java/res/xml/keyboard_layout_set_hindi.xml
index c1fd0712db5b51aa7dca9f3430e1e683c7f7c01e..e850c7ebca629edf1a1d980731e84f8ba83391c7 100644
--- a/java/res/xml-hi/keyboard_set.xml
+++ b/java/res/xml/keyboard_layout_set_hindi.xml
@@ -18,7 +18,7 @@
 */
 -->
 
-<KeyboardSet
+<KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
     <Element
         latin:elementName="alphabet"
@@ -55,4 +55,4 @@
     <Element
         latin:elementName="number"
         latin:elementKeyboard="@xml/kbd_number" />
-</KeyboardSet>
+</KeyboardLayoutSet>
diff --git a/java/res/xml-is/keyboard_set.xml b/java/res/xml/keyboard_layout_set_nordic.xml
similarity index 97%
rename from java/res/xml-is/keyboard_set.xml
rename to java/res/xml/keyboard_layout_set_nordic.xml
index 44edbba3eda91c6edfb3cf8c983cff7301bbfb83..1f00f440e114cb3f369e5ead5369659288116c92 100644
--- a/java/res/xml-is/keyboard_set.xml
+++ b/java/res/xml/keyboard_layout_set_nordic.xml
@@ -18,7 +18,7 @@
 */
 -->
 
-<KeyboardSet
+<KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
     <Element
         latin:elementName="alphabet"
@@ -39,4 +39,4 @@
     <Element
         latin:elementName="number"
         latin:elementKeyboard="@xml/kbd_number" />
-</KeyboardSet>
+</KeyboardLayoutSet>
diff --git a/java/res/xml-zz-rQY/keyboard_set.xml b/java/res/xml/keyboard_layout_set_qwerty.xml
similarity index 97%
rename from java/res/xml-zz-rQY/keyboard_set.xml
rename to java/res/xml/keyboard_layout_set_qwerty.xml
index e9eddbf055f8e11b1f88c1fc1604852df60c5a27..82151708136f10d519351d0c09a9a16633b8fa2f 100644
--- a/java/res/xml-zz-rQY/keyboard_set.xml
+++ b/java/res/xml/keyboard_layout_set_qwerty.xml
@@ -18,7 +18,7 @@
 */
 -->
 
-<KeyboardSet
+<KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
     <Element
         latin:elementName="alphabet"
@@ -39,4 +39,4 @@
     <Element
         latin:elementName="number"
         latin:elementKeyboard="@xml/kbd_number" />
-</KeyboardSet>
+</KeyboardLayoutSet>
diff --git a/java/res/xml/keyboard_layout_set_qwertz.xml b/java/res/xml/keyboard_layout_set_qwertz.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f9e87a66fc8fd2640ff51ba8fd13352f1345f31b
--- /dev/null
+++ b/java/res/xml/keyboard_layout_set_qwertz.xml
@@ -0,0 +1,42 @@
+<?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.
+*/
+-->
+
+<KeyboardLayoutSet
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+    <Element
+        latin:elementName="alphabet"
+        latin:elementKeyboard="@xml/kbd_qwertz"
+        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-mk/keyboard_set.xml b/java/res/xml/keyboard_layout_set_south_slavic.xml
similarity index 97%
rename from java/res/xml-mk/keyboard_set.xml
rename to java/res/xml/keyboard_layout_set_south_slavic.xml
index 6b8b844343948cfa876cc0327786a548624ce6d9..36666b91b0c4a8befd3f2d2380168aba87c69db1 100644
--- a/java/res/xml-mk/keyboard_set.xml
+++ b/java/res/xml/keyboard_layout_set_south_slavic.xml
@@ -18,7 +18,7 @@
 */
 -->
 
-<KeyboardSet
+<KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
     <Element
         latin:elementName="alphabet"
@@ -39,4 +39,4 @@
     <Element
         latin:elementName="number"
         latin:elementKeyboard="@xml/kbd_number" />
-</KeyboardSet>
+</KeyboardLayoutSet>
diff --git a/java/res/xml-es/keyboard_set.xml b/java/res/xml/keyboard_layout_set_spanish.xml
similarity index 93%
rename from java/res/xml-es/keyboard_set.xml
rename to java/res/xml/keyboard_layout_set_spanish.xml
index 4ff5b54f2ef2075cadb35a569ccaa722068f3dc4..0ef712b761caaa3263e4e15aa6b640cfd5af94a0 100644
--- a/java/res/xml-es/keyboard_set.xml
+++ b/java/res/xml/keyboard_layout_set_spanish.xml
@@ -2,7 +2,7 @@
 <!--
 /*
 **
-** Copyright 2011, The Android Open Source Project
+** 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.
@@ -18,7 +18,7 @@
 */
 -->
 
-<KeyboardSet
+<KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
     <Element
         latin:elementName="alphabet"
@@ -39,4 +39,4 @@
     <Element
         latin:elementName="number"
         latin:elementKeyboard="@xml/kbd_number" />
-</KeyboardSet>
+</KeyboardLayoutSet>
diff --git a/java/res/xml-th/keyboard_set.xml b/java/res/xml/keyboard_layout_set_thai.xml
similarity index 98%
rename from java/res/xml-th/keyboard_set.xml
rename to java/res/xml/keyboard_layout_set_thai.xml
index 99e81b85ec854c366af398033501fe01657add7d..94713e3d4e835180dde64e9c79e6defe32a45d21 100644
--- a/java/res/xml-th/keyboard_set.xml
+++ b/java/res/xml/keyboard_layout_set_thai.xml
@@ -18,7 +18,7 @@
 */
 -->
 
-<KeyboardSet
+<KeyboardLayoutSet
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
     <Element
         latin:elementName="alphabet"
@@ -55,4 +55,4 @@
     <Element
         latin:elementName="number"
         latin:elementKeyboard="@xml/kbd_number" />
-</KeyboardSet>
+</KeyboardLayoutSet>
diff --git a/java/res/xml/keyboard_set.xml b/java/res/xml/keyboard_set.xml
deleted file mode 100644
index 8966ddbb05c1466cc84f3629d879f5b63fbac44c..0000000000000000000000000000000000000000
--- a/java/res/xml/keyboard_set.xml
+++ /dev/null
@@ -1,42 +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.
-*/
--->
-
-<KeyboardSet
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
-    <Element
-        latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_qwerty"
-        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" />
-</KeyboardSet>
diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml
index e43fb32a4dc03ba553c7dc858218a62dd06ce748..ba45343514d79cc073dbe27212aac951329cd19f 100644
--- a/java/res/xml/method.xml
+++ b/java/res/xml/method.xml
@@ -20,7 +20,8 @@
 <!-- The attributes in this XML file provide configuration information -->
 <!-- for the Input Method Manager. -->
 
-<!-- Supported locales: name/layout
+<!-- Supported subtypes
+    keyboard_locale: script_name/keyboard_layout_set[:keyboard_locale]
     ar: Arabic/arabic
     be: Belarusian/east_slavic
     bg: Bulgarian/bulgarian
@@ -75,246 +76,259 @@
             android:label="@string/subtype_en_US"
             android:imeSubtypeLocale="en_US"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="TrySuppressingImeSwitcher,AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,TrySuppressingImeSwitcher,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_en_GB"
             android:imeSubtypeLocale="en_GB"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="TrySuppressingImeSwitcher,AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,TrySuppressingImeSwitcher,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="ar"
             android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=arabic"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="be"
             android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=east_slavic"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="bg"
             android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=bulgarian"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="cs"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwertz,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="da"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=nordic,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="de"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwertz,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic_qwerty"
             android:imeSubtypeLocale="de"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable,KeyboardLocale=de_QY"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty:de_QY,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="el"
             android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=greek"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="es"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=spanish,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="et"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=nordic,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="fa"
             android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=farsi"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="fi"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=nordic,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="fr"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=azerty,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="fr_CA"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="fr_CH"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwertz,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="hi"
             android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=hindi"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="hr"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwertz,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="hu"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwertz,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="is"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="it"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
     />
     <!-- Java uses the deprecated "iw" code instead of the standard "he" code for Hebrew. -->
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="iw"
             android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=hebrew"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="ka"
             android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=georgian"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="ky"
             android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=east_slavic"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="lt"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="lv"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="mk"
             android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=south_slavic"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="nb"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=nordic,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="nl"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="pl"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="pt"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="ro"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="ru"
             android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=east_slavic"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="sk"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="sl"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="sr"
             android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=south_slavic"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="sv"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=nordic,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
-            android:imeSubtypeLocale="tr"
+            android:imeSubtypeLocale="th"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=thai"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
-            android:imeSubtypeLocale="th"
+            android:imeSubtypeLocale="tr"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue=""
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="uk"
             android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=east_slavic"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
             android:imeSubtypeLocale="vi"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_no_language_qwerty"
             android:imeSubtypeLocale="zz_QY"
             android:imeSubtypeMode="keyboard"
-            android:imeSubtypeExtraValue="AsciiCapable,EnabledWhenDefaultIsNotAsciiCapable"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable,EnabledWhenDefaultIsNotAsciiCapable"
     />
 </input-method>
diff --git a/java/res/xml/rowkeys_georgian1.xml b/java/res/xml/rowkeys_georgian1.xml
index 6b24c29fe487ebddbd2daed193f3a349c2b960fd..fcdf3fa588d9bdb68c80e4dcfb5fc3d1649ab757 100644
--- a/java/res/xml/rowkeys_georgian1.xml
+++ b/java/res/xml/rowkeys_georgian1.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <Key
                 latin:keyLabel="Q"
diff --git a/java/res/xml/rowkeys_georgian2.xml b/java/res/xml/rowkeys_georgian2.xml
index f50e3d64b923baa168834ef9ee0f4b42ad0bea05..5673b900212271f89f5fe7eaca3d991dd3ba3c8c 100644
--- a/java/res/xml/rowkeys_georgian2.xml
+++ b/java/res/xml/rowkeys_georgian2.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <Key
                 latin:keyLabel="A"
diff --git a/java/res/xml/rowkeys_georgian3.xml b/java/res/xml/rowkeys_georgian3.xml
index f908673af9c9ef3c991a04f742df4c2ff514eab6..1c0f45befd515d1c68a0620711762a82b88d7dcf 100644
--- a/java/res/xml/rowkeys_georgian3.xml
+++ b/java/res/xml/rowkeys_georgian3.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <!-- U+10EB: "ძ" GEORGIAN LETTER JIL -->
             <Key
diff --git a/java/res/xml/rowkeys_greek1.xml b/java/res/xml/rowkeys_greek1.xml
index 4df49f8515a18dd10923ed9331d6d5591b1e64a4..5777d3b85919650d24922d3d29c1c78260ec2b06 100644
--- a/java/res/xml/rowkeys_greek1.xml
+++ b/java/res/xml/rowkeys_greek1.xml
@@ -25,7 +25,7 @@
     <!--
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLockShifted"
         >
             U+0385: "Î…" GREEK DIALYTIKA TONOS
             <Key
diff --git a/java/res/xml/rowkeys_hindi1.xml b/java/res/xml/rowkeys_hindi1.xml
index eb99de96de6521d95108b235e9c99a7f871a1b5f..656ba01c4fce34cb7c9b0a545bbe2b9e05de0adc 100644
--- a/java/res/xml/rowkeys_hindi1.xml
+++ b/java/res/xml/rowkeys_hindi1.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <!-- U+0914: "औ" DEVANAGARI LETTER AU
                  U+0912/U+0902: "ऒं" DEVANAGARI LETTER SHORT O//DEVANAGARI SIGN ANUSVARA -->
diff --git a/java/res/xml/rowkeys_hindi2.xml b/java/res/xml/rowkeys_hindi2.xml
index 95f488102795d7f718405e6560eb88afe70caaaf..05e3db202a235e9770ec512d90a5d253633c7b06 100644
--- a/java/res/xml/rowkeys_hindi2.xml
+++ b/java/res/xml/rowkeys_hindi2.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <!-- U+0913: "ओ" DEVANAGARI LETTER O
                  U+0913/U+0902: "ओं" DEVANAGARI LETTER O/DEVANAGARI SIGN ANUSVARA
diff --git a/java/res/xml/rowkeys_hindi3.xml b/java/res/xml/rowkeys_hindi3.xml
index c023115ee4a769f4b32b46f7b5018a9f7839b5fe..92bcb56b35b2e413ac7819fac791cc822c36ee26 100644
--- a/java/res/xml/rowkeys_hindi3.xml
+++ b/java/res/xml/rowkeys_hindi3.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <!-- U+0911: "ऑ" DEVANAGARI LETTER CANDRA O -->
             <Key
diff --git a/java/res/xml/rowkeys_thai1.xml b/java/res/xml/rowkeys_thai1.xml
index 943112a1a6af193e29b236cc5fe559fba7f91dab..4b49da171910dbcf28c0cde71625d51e06ca6d41 100644
--- a/java/res/xml/rowkeys_thai1.xml
+++ b/java/res/xml/rowkeys_thai1.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <!-- U+0E0E: "ฎ" THAI CHARACTER DO CHADA -->
             <Key
diff --git a/java/res/xml/rowkeys_thai2.xml b/java/res/xml/rowkeys_thai2.xml
index 02ea6c5f85179290f91bae562b143dd1caa4fe00..80e3563f87a5257e3a85747e32f3bfb0752e4b5f 100644
--- a/java/res/xml/rowkeys_thai2.xml
+++ b/java/res/xml/rowkeys_thai2.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <!-- U+0E24: "ฤ" THAI CHARACTER RU -->
             <Key
diff --git a/java/res/xml/rowkeys_thai3.xml b/java/res/xml/rowkeys_thai3.xml
index 72c0deffe62a9254bbb500f5fd4b7bdc96afaf22..b8338073c05c34cf071e602c8906717b2505fd85 100644
--- a/java/res/xml/rowkeys_thai3.xml
+++ b/java/res/xml/rowkeys_thai3.xml
@@ -23,7 +23,7 @@
 >
     <switch>
         <case
-            latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
             <!-- U+0E09: "ฉ" THAI CHARACTER CHO CHING -->
             <Key
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 67e4e4a960b25d3d06f47315d08d6528833de8e8..6ada09067d4398eff7b9225ad24775817a09038a 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -239,7 +239,7 @@ public class Keyboard {
         public final ArrayList<Key> mAltCodeKeysWhileTyping = new ArrayList<Key>();
         public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet();
 
-        public KeyboardSet.KeysCache mKeysCache;
+        public KeyboardLayoutSet.KeysCache mKeysCache;
 
         public int mMostCommonKeyHeight = 0;
         public int mMostCommonKeyWidth = 0;
@@ -637,7 +637,7 @@ public class Keyboard {
             params.GRID_HEIGHT = res.getInteger(R.integer.config_keyboard_grid_height);
         }
 
-        public void setAutoGenerate(KeyboardSet.KeysCache keysCache) {
+        public void setAutoGenerate(KeyboardLayoutSet.KeysCache keysCache) {
             mParams.mKeysCache = keysCache;
         }
 
@@ -1061,8 +1061,8 @@ public class Keyboard {
             final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser),
                     R.styleable.Keyboard_Case);
             try {
-                final boolean keyboardSetElementMatched = matchTypedValue(a,
-                        R.styleable.Keyboard_Case_keyboardSetElement, id.mElementId,
+                final boolean keyboardLayoutSetElementMatched = matchTypedValue(a,
+                        R.styleable.Keyboard_Case_keyboardLayoutSetElement, id.mElementId,
                         KeyboardId.elementIdToName(id.mElementId));
                 final boolean modeMatched = matchTypedValue(a,
                         R.styleable.Keyboard_Case_mode, id.mMode, KeyboardId.modeName(id.mMode));
@@ -1091,7 +1091,7 @@ public class Keyboard {
                         R.styleable.Keyboard_Case_languageCode, id.mLocale.getLanguage());
                 final boolean countryCodeMatched = matchString(a,
                         R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry());
-                final boolean selected = keyboardSetElementMatched && modeMatched
+                final boolean selected = keyboardLayoutSetElementMatched && modeMatched
                         && navigateNextMatched && navigatePreviousMatched && passwordInputMatched
                         && clobberSettingsKeyMatched && shortcutKeyEnabledMatched
                         && hasShortcutKeyMatched && languageSwitchKeyEnabledMatched
@@ -1100,8 +1100,9 @@ public class Keyboard {
 
                 if (DEBUG) {
                     startTag("<%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s>%s", TAG_CASE,
-                            textAttr(a.getString(R.styleable.Keyboard_Case_keyboardSetElement),
-                                    "keyboardSetElement"),
+                            textAttr(a.getString(
+                                    R.styleable.Keyboard_Case_keyboardLayoutSetElement),
+                                    "keyboardLayoutSetElement"),
                             textAttr(a.getString(R.styleable.Keyboard_Case_mode), "mode"),
                             textAttr(a.getString(R.styleable.Keyboard_Case_imeAction),
                                     "imeAction"),
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java b/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java
similarity index 68%
rename from java/src/com/android/inputmethod/keyboard/KeyboardSet.java
rename to java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java
index f9b6b72c7045924d2554491dc361f483a47e3cab..51cd9054981e7a3bb1160571842c241d4622eaec 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java
@@ -28,14 +28,17 @@ import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputMethodSubtype;
 
 import com.android.inputmethod.compat.EditorInfoCompatUtils;
-import com.android.inputmethod.keyboard.KeyboardSet.Params.ElementParams;
+import com.android.inputmethod.keyboard.KeyboardLayoutSet.Params.ElementParams;
+import com.android.inputmethod.keyboard.internal.KeySpecParser;
 import com.android.inputmethod.latin.InputTypeUtils;
 import com.android.inputmethod.latin.LatinIME;
 import com.android.inputmethod.latin.LatinImeLogger;
+import com.android.inputmethod.latin.LocaleUtils;
 import com.android.inputmethod.latin.LocaleUtils.RunInLocale;
 import com.android.inputmethod.latin.R;
 import com.android.inputmethod.latin.StringUtils;
 import com.android.inputmethod.latin.SubtypeLocale;
+import com.android.inputmethod.latin.SubtypeSwitcher;
 import com.android.inputmethod.latin.XmlParseUtils;
 
 import org.xmlpull.v1.XmlPullParser;
@@ -47,18 +50,25 @@ import java.util.HashMap;
 import java.util.Locale;
 
 /**
- * This class represents a set of keyboards. Each of them represents a different keyboard
+ * This class represents a set of keyboard layouts. Each of them represents a different keyboard
  * specific to a keyboard state, such as alphabet, symbols, and so on.  Layouts in the same
- * {@link KeyboardSet} are related to each other.
- * A {@link KeyboardSet} needs to be created for each {@link android.view.inputmethod.EditorInfo}.
+ * {@link KeyboardLayoutSet} are related to each other.
+ * A {@link KeyboardLayoutSet} needs to be created for each
+ * {@link android.view.inputmethod.EditorInfo}.
  */
-public class KeyboardSet {
-    private static final String TAG = KeyboardSet.class.getSimpleName();
+public class KeyboardLayoutSet {
+    private static final String TAG = KeyboardLayoutSet.class.getSimpleName();
     private static final boolean DEBUG_CACHE = LatinImeLogger.sDBG;
 
-    private static final String TAG_KEYBOARD_SET = "KeyboardSet";
+    private static final String TAG_KEYBOARD_SET = "KeyboardLayoutSet";
     private static final String TAG_ELEMENT = "Element";
 
+    private static final String DEFAULT_KEYBOARD_LAYOUT_SET = "qwerty";
+    private static final char KEYBOARD_LAYOUT_SET_LOCALE_DELIMITER = ':';
+    private static final String KEYBOARD_LAYOUT_SET_RESOURCE_PREFIX = "xml/keyboard_layout_set_";
+    private static final int DEFAULT_KEYBOARD_LAYOUT_SET_RESOURCE_ID =
+            R.xml.keyboard_layout_set_qwerty;
+
     private final Context mContext;
     private final Params mParams;
 
@@ -66,10 +76,10 @@ public class KeyboardSet {
             new HashMap<KeyboardId, SoftReference<Keyboard>>();
     private static final KeysCache sKeysCache = new KeysCache();
 
-    public static class KeyboardSetException extends RuntimeException {
+    public static class KeyboardLayoutSetException extends RuntimeException {
         public final KeyboardId mKeyboardId;
 
-        public KeyboardSetException(Throwable cause, KeyboardId keyboardId) {
+        public KeyboardLayoutSetException(Throwable cause, KeyboardId keyboardId) {
             super(cause);
             mKeyboardId = keyboardId;
         }
@@ -98,6 +108,7 @@ public class KeyboardSet {
     }
 
     static class Params {
+        String mKeyboardLayoutSetName;
         int mMode;
         EditorInfo mEditorInfo;
         boolean mTouchPositionCorrectionEnabled;
@@ -108,8 +119,8 @@ public class KeyboardSet {
         Locale mLocale;
         int mOrientation;
         int mWidth;
-        // KeyboardSet element id to element's parameters map.
-        final HashMap<Integer, ElementParams> mKeyboardSetElementIdToParamsMap =
+        // KeyboardLayoutSet element id to element's parameters map.
+        final HashMap<Integer, ElementParams> mKeyboardLayoutSetElementIdToParamsMap =
                 new HashMap<Integer, ElementParams>();
 
         static class ElementParams {
@@ -123,43 +134,43 @@ public class KeyboardSet {
         sKeysCache.clear();
     }
 
-    private KeyboardSet(Context context, Params params) {
+    private KeyboardLayoutSet(Context context, Params params) {
         mContext = context;
         mParams = params;
     }
 
-    public Keyboard getKeyboard(int baseKeyboardSetElementId) {
-        final int keyboardSetElementId;
+    public Keyboard getKeyboard(int baseKeyboardLayoutSetElementId) {
+        final int keyboardLayoutSetElementId;
         switch (mParams.mMode) {
         case KeyboardId.MODE_PHONE:
-            if (baseKeyboardSetElementId == KeyboardId.ELEMENT_SYMBOLS) {
-                keyboardSetElementId = KeyboardId.ELEMENT_PHONE_SYMBOLS;
+            if (baseKeyboardLayoutSetElementId == KeyboardId.ELEMENT_SYMBOLS) {
+                keyboardLayoutSetElementId = KeyboardId.ELEMENT_PHONE_SYMBOLS;
             } else {
-                keyboardSetElementId = KeyboardId.ELEMENT_PHONE;
+                keyboardLayoutSetElementId = KeyboardId.ELEMENT_PHONE;
             }
             break;
         case KeyboardId.MODE_NUMBER:
         case KeyboardId.MODE_DATE:
         case KeyboardId.MODE_TIME:
         case KeyboardId.MODE_DATETIME:
-            keyboardSetElementId = KeyboardId.ELEMENT_NUMBER;
+            keyboardLayoutSetElementId = KeyboardId.ELEMENT_NUMBER;
             break;
         default:
-            keyboardSetElementId = baseKeyboardSetElementId;
+            keyboardLayoutSetElementId = baseKeyboardLayoutSetElementId;
             break;
         }
 
-        ElementParams elementParams = mParams.mKeyboardSetElementIdToParamsMap.get(
-                keyboardSetElementId);
+        ElementParams elementParams = mParams.mKeyboardLayoutSetElementIdToParamsMap.get(
+                keyboardLayoutSetElementId);
         if (elementParams == null) {
-            elementParams = mParams.mKeyboardSetElementIdToParamsMap.get(
+            elementParams = mParams.mKeyboardLayoutSetElementIdToParamsMap.get(
                     KeyboardId.ELEMENT_ALPHABET);
         }
-        final KeyboardId id = getKeyboardId(keyboardSetElementId);
+        final KeyboardId id = getKeyboardId(keyboardLayoutSetElementId);
         try {
             return getKeyboard(mContext, elementParams, id);
         } catch (RuntimeException e) {
-            throw new KeyboardSetException(e, id);
+            throw new KeyboardLayoutSetException(e, id);
         }
     }
 
@@ -199,21 +210,46 @@ public class KeyboardSet {
         return keyboard;
     }
 
-    // Note: The keyboard for each locale, shift state, and mode are represented as KeyboardSet
-    // element id that is a key in keyboard_set.xml.  Also that file specifies which XML layout
-    // should be used for each keyboard.  The KeyboardId is an internal key for Keyboard object.
-    private KeyboardId getKeyboardId(int keyboardSetElementId) {
+    // Note: The keyboard for each locale, shift state, and mode are represented as
+    // KeyboardLayoutSet element id that is a key in keyboard_set.xml.  Also that file specifies
+    // which XML layout should be used for each keyboard.  The KeyboardId is an internal key for
+    // Keyboard object.
+    private KeyboardId getKeyboardId(int keyboardLayoutSetElementId) {
         final Params params = mParams;
-        final boolean isSymbols = (keyboardSetElementId == KeyboardId.ELEMENT_SYMBOLS
-                || keyboardSetElementId == KeyboardId.ELEMENT_SYMBOLS_SHIFTED);
+        final boolean isSymbols = (keyboardLayoutSetElementId == KeyboardId.ELEMENT_SYMBOLS
+                || keyboardLayoutSetElementId == KeyboardId.ELEMENT_SYMBOLS_SHIFTED);
         final boolean noLanguage = params.mLocale.getLanguage().equals(SubtypeLocale.NO_LANGUAGE);
         final boolean voiceKeyEnabled = params.mVoiceKeyEnabled && !noLanguage;
         final boolean hasShortcutKey = voiceKeyEnabled && (isSymbols != params.mVoiceKeyOnMain);
-        return new KeyboardId(keyboardSetElementId, params.mLocale, params.mOrientation,
+        return new KeyboardId(keyboardLayoutSetElementId, params.mLocale, params.mOrientation,
                 params.mWidth, params.mMode, params.mEditorInfo, params.mNoSettingsKey,
                 voiceKeyEnabled, hasShortcutKey, params.mLanguageSwitchKeyEnabled);
     }
 
+    private static String getKeyboardLayoutSetName(InputMethodSubtype subtype) {
+        final String keyboardLayoutSet = subtype.getExtraValueOf(
+                LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LAYOUT_SET);
+        // TODO: Remove this null check when InputMethodManager.getCurrentInputMethodSubtype is
+        // fixed.
+        if (keyboardLayoutSet == null) return DEFAULT_KEYBOARD_LAYOUT_SET;
+        final int pos = keyboardLayoutSet.indexOf(KEYBOARD_LAYOUT_SET_LOCALE_DELIMITER);
+        return (pos > 0) ? keyboardLayoutSet.substring(0, pos) : keyboardLayoutSet;
+    }
+
+    public static String getKeyboardLayoutSetLocaleString(InputMethodSubtype subtype) {
+        final String keyboardLayoutSet = subtype.getExtraValueOf(
+                LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LAYOUT_SET);
+        // TODO: Remove this null check when InputMethodManager.getCurrentInputMethodSubtype is
+        // fixed.
+        if (keyboardLayoutSet == null) return subtype.getLocale();
+        final int pos = keyboardLayoutSet.indexOf(KEYBOARD_LAYOUT_SET_LOCALE_DELIMITER);
+        return (pos > 0) ? keyboardLayoutSet.substring(pos + 1) : subtype.getLocale();
+    }
+
+    public static Locale getKeyboardLayoutSetLocale(InputMethodSubtype subtype) {
+        return LocaleUtils.constructLocaleFromString(getKeyboardLayoutSetLocaleString(subtype));
+    }
+
     public static class Builder {
         private final Context mContext;
         private final String mPackageName;
@@ -244,7 +280,6 @@ public class KeyboardSet {
         }
 
         public Builder setSubtype(InputMethodSubtype subtype) {
-            final Locale inputLocale = SubtypeLocale.getSubtypeLocale(subtype);
             final boolean asciiCapable = subtype.containsExtraValueKey(
                     LatinIME.SUBTYPE_EXTRA_VALUE_ASCII_CAPABLE);
             final boolean deprecatedForceAscii = StringUtils.inPrivateImeOptions(
@@ -252,8 +287,12 @@ public class KeyboardSet {
             final boolean forceAscii = EditorInfoCompatUtils.hasFlagForceAscii(
                     mParams.mEditorInfo.imeOptions)
                     || deprecatedForceAscii;
-            mParams.mLocale = (forceAscii && !asciiCapable)
-                    ? SubtypeLocale.LOCALE_NO_LANGUAGE_QWERTY : inputLocale;
+            final InputMethodSubtype keyboardSubtype = (forceAscii && !asciiCapable)
+                    ? SubtypeSwitcher.getInstance().getNoLanguageSubtype()
+                    : subtype;
+            mParams.mLocale = getKeyboardLayoutSetLocale(keyboardSubtype);
+            mParams.mKeyboardLayoutSetName = KEYBOARD_LAYOUT_SET_RESOURCE_PREFIX
+                    + getKeyboardLayoutSetName(keyboardSubtype);
             return this;
         }
 
@@ -275,31 +314,31 @@ public class KeyboardSet {
             mParams.mTouchPositionCorrectionEnabled = enabled;
         }
 
-        public KeyboardSet build() {
+        public KeyboardLayoutSet build() {
             if (mParams.mOrientation == Configuration.ORIENTATION_UNDEFINED)
                 throw new RuntimeException("Screen geometry is not specified");
             if (mParams.mLocale == null)
-                throw new RuntimeException("KeyboardSet subtype is not specified");
-
+                throw new RuntimeException("KeyboardLayoutSet subtype is not specified");
+            final String keyboardLayoutSetName = mParams.mKeyboardLayoutSetName;
+            final int xmlId = KeySpecParser.getResourceId(
+                    mResources, keyboardLayoutSetName, DEFAULT_KEYBOARD_LAYOUT_SET_RESOURCE_ID);
             final RunInLocale<Void> job = new RunInLocale<Void>() {
                 @Override
                 protected Void job(Resources res) {
                     try {
-                        parseKeyboardSet(res, R.xml.keyboard_set);
+                        parseKeyboardLayoutSet(res, xmlId);
                     } catch (Exception e) {
-                        throw new RuntimeException(e.getMessage() + " in "
-                                + res.getResourceName(R.xml.keyboard_set)
-                                + " of locale " + mParams.mLocale);
+                        throw new RuntimeException(e.getMessage() + " in " + keyboardLayoutSetName);
                     }
                     return null;
                 }
             };
             job.runInLocale(mResources, mParams.mLocale);
-            return new KeyboardSet(mContext, mParams);
+            return new KeyboardLayoutSet(mContext, mParams);
         }
 
-        private void parseKeyboardSet(Resources res, int resId) throws XmlPullParserException,
-                IOException {
+        private void parseKeyboardLayoutSet(Resources res, int resId)
+                throws XmlPullParserException, IOException {
             final XmlResourceParser parser = res.getXml(resId);
             try {
                 int event;
@@ -307,7 +346,7 @@ public class KeyboardSet {
                     if (event == XmlPullParser.START_TAG) {
                         final String tag = parser.getName();
                         if (TAG_KEYBOARD_SET.equals(tag)) {
-                            parseKeyboardSetContent(parser);
+                            parseKeyboardLayoutSetContent(parser);
                         } else {
                             throw new XmlParseUtils.IllegalStartTag(parser, TAG_KEYBOARD_SET);
                         }
@@ -318,14 +357,14 @@ public class KeyboardSet {
             }
         }
 
-        private void parseKeyboardSetContent(XmlPullParser parser) throws XmlPullParserException,
-                IOException {
+        private void parseKeyboardLayoutSetContent(XmlPullParser parser)
+                throws XmlPullParserException, IOException {
             int event;
             while ((event = parser.next()) != XmlPullParser.END_DOCUMENT) {
                 if (event == XmlPullParser.START_TAG) {
                     final String tag = parser.getName();
                     if (TAG_ELEMENT.equals(tag)) {
-                        parseKeyboardSetElement(parser);
+                        parseKeyboardLayoutSetElement(parser);
                     } else {
                         throw new XmlParseUtils.IllegalStartTag(parser, TAG_KEYBOARD_SET);
                     }
@@ -340,27 +379,28 @@ public class KeyboardSet {
             }
         }
 
-        private void parseKeyboardSetElement(XmlPullParser parser) throws XmlPullParserException,
-                IOException {
+        private void parseKeyboardLayoutSetElement(XmlPullParser parser)
+                throws XmlPullParserException, IOException {
             final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser),
-                    R.styleable.KeyboardSet_Element);
+                    R.styleable.KeyboardLayoutSet_Element);
             try {
                 XmlParseUtils.checkAttributeExists(a,
-                        R.styleable.KeyboardSet_Element_elementName, "elementName",
+                        R.styleable.KeyboardLayoutSet_Element_elementName, "elementName",
                         TAG_ELEMENT, parser);
                 XmlParseUtils.checkAttributeExists(a,
-                        R.styleable.KeyboardSet_Element_elementKeyboard, "elementKeyboard",
+                        R.styleable.KeyboardLayoutSet_Element_elementKeyboard, "elementKeyboard",
                         TAG_ELEMENT, parser);
                 XmlParseUtils.checkEndTag(TAG_ELEMENT, parser);
 
                 final ElementParams elementParams = new ElementParams();
                 final int elementName = a.getInt(
-                        R.styleable.KeyboardSet_Element_elementName, 0);
+                        R.styleable.KeyboardLayoutSet_Element_elementName, 0);
                 elementParams.mKeyboardXmlId = a.getResourceId(
-                        R.styleable.KeyboardSet_Element_elementKeyboard, 0);
+                        R.styleable.KeyboardLayoutSet_Element_elementKeyboard, 0);
                 elementParams.mProximityCharsCorrectionEnabled = a.getBoolean(
-                        R.styleable.KeyboardSet_Element_enableProximityCharsCorrection, false);
-                mParams.mKeyboardSetElementIdToParamsMap.put(elementName, elementParams);
+                        R.styleable.KeyboardLayoutSet_Element_enableProximityCharsCorrection,
+                        false);
+                mParams.mKeyboardLayoutSetElementIdToParamsMap.put(elementName, elementParams);
             } finally {
                 a.recycle();
             }
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 3bc63f3dd6b76024ddab5155f73df697c45c6614..e50d922eabcc12582a76734c52c0993880f4e7ae 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -27,7 +27,7 @@ import android.view.View;
 import android.view.inputmethod.EditorInfo;
 
 import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy;
-import com.android.inputmethod.keyboard.KeyboardSet.KeyboardSetException;
+import com.android.inputmethod.keyboard.KeyboardLayoutSet.KeyboardLayoutSetException;
 import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
 import com.android.inputmethod.keyboard.internal.KeyboardState;
 import com.android.inputmethod.latin.DebugSettings;
@@ -76,7 +76,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
 
     private KeyboardState mState;
 
-    private KeyboardSet mKeyboardSet;
+    private KeyboardLayoutSet mKeyboardLayoutSet;
 
     /** mIsAutoCorrectionActive indicates that auto corrected word will be input instead of
      * what user actually typed. */
@@ -129,12 +129,13 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
         if (mKeyboardTheme.mThemeId != keyboardTheme.mThemeId) {
             mKeyboardTheme = keyboardTheme;
             mThemeContext = new ContextThemeWrapper(context, keyboardTheme.mStyleId);
-            KeyboardSet.clearKeyboardCache();
+            KeyboardLayoutSet.clearKeyboardCache();
         }
     }
 
     public void loadKeyboard(EditorInfo editorInfo, SettingsValues settingsValues) {
-        final KeyboardSet.Builder builder = new KeyboardSet.Builder(mThemeContext, editorInfo);
+        final KeyboardLayoutSet.Builder builder = new KeyboardLayoutSet.Builder(
+                mThemeContext, editorInfo);
         builder.setScreenGeometry(mThemeContext.getResources().getConfiguration().orientation,
                 mThemeContext.getResources().getDisplayMetrics().widthPixels);
         builder.setSubtype(mSubtypeSwitcher.getCurrentSubtype());
@@ -142,10 +143,10 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
                 settingsValues.isVoiceKeyEnabled(editorInfo),
                 settingsValues.isVoiceKeyOnMain(),
                 settingsValues.isLanguageSwitchKeyEnabled(mThemeContext));
-        mKeyboardSet = builder.build();
+        mKeyboardLayoutSet = builder.build();
         try {
             mState.onLoadKeyboard(mResources.getString(R.string.layout_switch_back_symbols));
-        } catch (KeyboardSetException e) {
+        } catch (KeyboardLayoutSetException e) {
             Log.w(TAG, "loading keyboard failed: " + e.mKeyboardId, e.getCause());
             LatinImeLogger.logOnException(e.mKeyboardId.toString(), e.getCause());
             return;
@@ -214,43 +215,43 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
     // Implements {@link KeyboardState.SwitchActions}.
     @Override
     public void setAlphabetKeyboard() {
-        setKeyboard(mKeyboardSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET));
+        setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET));
     }
 
     // Implements {@link KeyboardState.SwitchActions}.
     @Override
     public void setAlphabetManualShiftedKeyboard() {
-        setKeyboard(mKeyboardSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED));
+        setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED));
     }
 
     // Implements {@link KeyboardState.SwitchActions}.
     @Override
     public void setAlphabetAutomaticShiftedKeyboard() {
-        setKeyboard(mKeyboardSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED));
+        setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED));
     }
 
     // Implements {@link KeyboardState.SwitchActions}.
     @Override
     public void setAlphabetShiftLockedKeyboard() {
-        setKeyboard(mKeyboardSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED));
+        setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED));
     }
 
     // Implements {@link KeyboardState.SwitchActions}.
     @Override
     public void setAlphabetShiftLockShiftedKeyboard() {
-        setKeyboard(mKeyboardSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED));
+        setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED));
     }
 
     // Implements {@link KeyboardState.SwitchActions}.
     @Override
     public void setSymbolsKeyboard() {
-        setKeyboard(mKeyboardSet.getKeyboard(KeyboardId.ELEMENT_SYMBOLS));
+        setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_SYMBOLS));
     }
 
     // Implements {@link KeyboardState.SwitchActions}.
     @Override
     public void setSymbolsShiftedKeyboard() {
-        setKeyboard(mKeyboardSet.getKeyboard(KeyboardId.ELEMENT_SYMBOLS_SHIFTED));
+        setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_SYMBOLS_SHIFTED));
     }
 
     // Implements {@link KeyboardState.SwitchActions}.
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java b/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java
index 0aba813b2ac2ab9ae7d64fa1f381069ee326a248..4abd887f062fb8571f760b128d3e7ae01f1093ef 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java
@@ -318,7 +318,7 @@ public class KeySpecParser {
         }
     }
 
-    private static int getResourceId(Resources res, String name, int packageNameResId) {
+    public static int getResourceId(Resources res, String name, int packageNameResId) {
         String packageName = res.getResourcePackageName(packageNameResId);
         int resId = res.getIdentifier(name, null, packageName);
         if (resId == 0) {
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 8a26d2b9eac4bc3f103842f97701ad6b11c28c9b..f5c09974e907297d11ea36affaf32bc373f0f1b3 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -115,16 +115,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
     public static final String IME_OPTION_FORCE_ASCII = "forceAscii";
 
     /**
-     * The subtype extra value used to indicate that the subtype keyboard layout is capable for
-     * typing ASCII characters.
+     * The subtype extra value used to indicate that the subtype keyboard layout set name.
      */
-    public static final String SUBTYPE_EXTRA_VALUE_ASCII_CAPABLE = "AsciiCapable";
+    public static final String SUBTYPE_EXTRA_VALUE_KEYBOARD_LAYOUT_SET = "KeyboardLayoutSet";
 
     /**
-     * The subtype extra value used to indicate that the subtype keyboard layout should be loaded
-     * from the specified locale.
+     * The subtype extra value used to indicate that the subtype keyboard layout is capable for
+     * typing ASCII characters.
      */
-    public static final String SUBTYPE_EXTRA_VALUE_KEYBOARD_LOCALE = "KeyboardLocale";
+    public static final String SUBTYPE_EXTRA_VALUE_ASCII_CAPABLE = "AsciiCapable";
 
     private static final int EXTENDED_TOUCHABLE_REGION_HEIGHT = 100;
 
diff --git a/java/src/com/android/inputmethod/latin/StringUtils.java b/java/src/com/android/inputmethod/latin/StringUtils.java
index 7000e46337782f14833d1ce999be2e052946203b..42fce53d08c01dc58bec522325a489d8b60bba30 100644
--- a/java/src/com/android/inputmethod/latin/StringUtils.java
+++ b/java/src/com/android/inputmethod/latin/StringUtils.java
@@ -22,6 +22,7 @@ import android.view.inputmethod.EditorInfo;
 import com.android.inputmethod.keyboard.Keyboard;
 
 import java.util.ArrayList;
+import java.util.Locale;
 
 public class StringUtils {
     private StringUtils() {
@@ -149,4 +150,20 @@ public class StringUtils {
             i++;
         }
     }
+
+    public static String toTitleCase(String s, Locale locale) {
+        if (s.length() <= 1) {
+            // TODO: is this really correct? Shouldn't this be s.toUpperCase()?
+            return s;
+        }
+        // TODO: fix the bugs below
+        // - This does not work for Greek, because it returns upper case instead of title case.
+        // - It does not work for Serbian, because it fails to account for the "lj" character,
+        // which should be "Lj" in title case and "LJ" in upper case.
+        // - It does not work for Dutch, because it fails to account for the "ij" digraph, which
+        // are two different characters but both should be capitalized as "IJ" as if they were
+        // a single letter.
+        // - It also does not work with unicode surrogate code points.
+        return s.toUpperCase(locale).charAt(0) + s.substring(1);
+    }
 }
diff --git a/java/src/com/android/inputmethod/latin/SubtypeLocale.java b/java/src/com/android/inputmethod/latin/SubtypeLocale.java
index fac74f0b52546caccc22b65f14c51f2380704c82..2bc22a6f93a8c7c26134fe508667d1dd106bb924 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeLocale.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeLocale.java
@@ -18,7 +18,7 @@ package com.android.inputmethod.latin;
 
 import android.content.Context;
 import android.content.res.Resources;
-import android.view.inputmethod.InputMethodSubtype;
+
 
 import java.util.Locale;
 
@@ -69,10 +69,10 @@ public class SubtypeLocale {
         }
         final String value = lookupExceptionalLocale(key);
         if (value == null) {
-            return toTitleCase(locale.getDisplayName(locale), locale);
+            return StringUtils.toTitleCase(locale.getDisplayName(locale), locale);
         }
         if (value.indexOf("%s") >= 0) {
-            final String languageName = toTitleCase(locale.getDisplayLanguage(locale), locale);
+            final String languageName = StringUtils.toTitleCase(locale.getDisplayLanguage(locale), locale);
             return String.format(value, languageName);
         }
         return value;
@@ -88,7 +88,7 @@ public class SubtypeLocale {
         if (NO_LANGUAGE.equals(locale.getLanguage())) {
             return lookupExceptionalLocale(locale.getCountry());
         } else {
-            return toTitleCase(locale.getDisplayLanguage(locale), locale);
+            return StringUtils.toTitleCase(locale.getDisplayLanguage(locale), locale);
         }
     }
 
@@ -102,33 +102,7 @@ public class SubtypeLocale {
         if (NO_LANGUAGE.equals(locale.getLanguage())) {
             return locale.getCountry();
         } else {
-            return toTitleCase(locale.getLanguage(), locale);
-        }
-    }
-
-    public static String toTitleCase(String s, Locale locale) {
-        if (s.length() <= 1) {
-            // TODO: is this really correct? Shouldn't this be s.toUpperCase()?
-            return s;
+            return StringUtils.toTitleCase(locale.getLanguage(), locale);
         }
-        // TODO: fix the bugs below
-        // - This does not work for Greek, because it returns upper case instead of title case.
-        // - It does not work for Serbian, because it fails to account for the "lj" character,
-        // which should be "Lj" in title case and "LJ" in upper case.
-        // - It does not work for Dutch, because it fails to account for the "ij" digraph, which
-        // are two different characters but both should be capitalized as "IJ" as if they were
-        // a single letter.
-        // - It also does not work with unicode surrogate code points.
-        return s.toUpperCase(locale).charAt(0) + s.substring(1);
-    }
-
-    public static String getSubtypeLocaleString(InputMethodSubtype subtype) {
-        final String keyboardLocale = subtype.getExtraValueOf(
-                LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LOCALE);
-        return keyboardLocale != null ? keyboardLocale : subtype.getLocale();
-    }
-
-    public static Locale getSubtypeLocale(InputMethodSubtype subtype) {
-        return LocaleUtils.constructLocaleFromString(getSubtypeLocaleString(subtype));
     }
 }
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
index 3ed7f8700b403b0a91b83e887a7a1fcff4047d66..dfb01a24cbe440453b4233d511e2731934239c3f 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
@@ -33,6 +33,7 @@ import android.view.inputmethod.InputMethodInfo;
 import android.view.inputmethod.InputMethodSubtype;
 
 import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
+import com.android.inputmethod.keyboard.KeyboardLayoutSet;
 import com.android.inputmethod.keyboard.KeyboardSwitcher;
 
 import java.util.ArrayList;
@@ -68,6 +69,7 @@ public class SubtypeSwitcher {
     private InputMethodInfo mShortcutInputMethodInfo;
     private InputMethodSubtype mShortcutSubtype;
     private List<InputMethodSubtype> mAllEnabledSubtypesOfCurrentInputMethod;
+    private InputMethodSubtype mNoLanguageSubtype;
     // Note: This variable is always non-null after {@link #initialize(LatinIME)}.
     private InputMethodSubtype mCurrentSubtype;
     private Locale mSystemLocale;
@@ -104,6 +106,8 @@ public class SubtypeSwitcher {
         mInputLocaleStr = null;
         mCurrentSubtype = mImm.getCurrentInputMethodSubtype();
         mAllEnabledSubtypesOfCurrentInputMethod = null;
+        mNoLanguageSubtype = SubtypeUtils.findSubtypeByKeyboardLayoutSetLocale(
+                service, SubtypeLocale.LOCALE_NO_LANGUAGE_QWERTY);
 
         final NetworkInfo info = mConnectivityManager.getActiveNetworkInfo();
         mIsNetworkConnected = (info != null && info.isConnected());
@@ -133,7 +137,7 @@ public class SubtypeSwitcher {
         mEnabledLanguagesOfCurrentInputMethod.clear();
         mEnabledKeyboardSubtypesOfCurrentInputMethod.clear();
         for (InputMethodSubtype ims : mAllEnabledSubtypesOfCurrentInputMethod) {
-            final String locale = getSubtypeLocale(ims);
+            final String locale = KeyboardLayoutSet.getKeyboardLayoutSetLocaleString(ims);
             final String mode = ims.getMode();
             mLocaleSplitter.setString(locale);
             if (mLocaleSplitter.hasNext()) {
@@ -162,7 +166,8 @@ public class SubtypeSwitcher {
             Log.d(TAG, "Update shortcut IME from : "
                     + (mShortcutInputMethodInfo == null
                             ? "<null>" : mShortcutInputMethodInfo.getId()) + ", "
-                    + (mShortcutSubtype == null ? "<null>" : (getSubtypeLocale(mShortcutSubtype)
+                    + (mShortcutSubtype == null ? "<null>" : (
+                            KeyboardLayoutSet.getKeyboardLayoutSetLocaleString(mShortcutSubtype)
                             + ", " + mShortcutSubtype.getMode())));
         }
         // TODO: Update an icon for shortcut IME
@@ -184,20 +189,15 @@ public class SubtypeSwitcher {
             Log.d(TAG, "Update shortcut IME to : "
                     + (mShortcutInputMethodInfo == null
                             ? "<null>" : mShortcutInputMethodInfo.getId()) + ", "
-                    + (mShortcutSubtype == null ? "<null>" : (getSubtypeLocale(mShortcutSubtype)
+                    + (mShortcutSubtype == null ? "<null>" : (
+                            KeyboardLayoutSet.getKeyboardLayoutSetLocaleString(mShortcutSubtype)
                             + ", " + mShortcutSubtype.getMode())));
         }
     }
 
-    private static String getSubtypeLocale(InputMethodSubtype subtype) {
-        final String keyboardLocale = subtype.getExtraValueOf(
-                LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LOCALE);
-        return keyboardLocale != null ? keyboardLocale : subtype.getLocale();
-    }
-
     // Update the current subtype. LatinIME.onCurrentInputMethodSubtypeChanged calls this function.
     public void updateSubtype(InputMethodSubtype newSubtype) {
-        final String newLocale = getSubtypeLocale(newSubtype);
+        final String newLocale = KeyboardLayoutSet.getKeyboardLayoutSetLocaleString(newSubtype);
         final String newMode = newSubtype.getMode();
         final String oldMode = getCurrentSubtypeMode();
         if (DBG) {
@@ -301,7 +301,8 @@ public class SubtypeSwitcher {
             final String imiPackageName = imi.getPackageName();
             if (DBG) {
                 Log.d(TAG, "Update icons of IME: " + imiPackageName + ","
-                        + getSubtypeLocale(subtype) + "," + subtype.getMode());
+                        + KeyboardLayoutSet.getKeyboardLayoutSetLocaleString(subtype) + ","
+                        + subtype.getMode());
             }
             if (subtype != null) {
                 return pm.getDrawable(imiPackageName, subtype.getIconResId(),
@@ -438,4 +439,8 @@ public class SubtypeSwitcher {
     public InputMethodSubtype getCurrentSubtype() {
         return mCurrentSubtype;
     }
+
+    public InputMethodSubtype getNoLanguageSubtype() {
+        return mNoLanguageSubtype;
+    }
 }
diff --git a/java/src/com/android/inputmethod/latin/SubtypeUtils.java b/java/src/com/android/inputmethod/latin/SubtypeUtils.java
index 2c5d58200483a46e1dc89aeec26007117c143680..a747c9ad759a7c261089670286af44d17a343dd6 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeUtils.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeUtils.java
@@ -21,9 +21,11 @@ import android.view.inputmethod.InputMethodInfo;
 import android.view.inputmethod.InputMethodSubtype;
 
 import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
+import com.android.inputmethod.keyboard.KeyboardLayoutSet;
 
 import java.util.Collections;
 import java.util.List;
+import java.util.Locale;
 
 public class SubtypeUtils {
     private SubtypeUtils() {
@@ -129,4 +131,18 @@ public class SubtypeUtils {
         }
         throw new RuntimeException("Can not find input method id for " + packageName);
     }
+
+    public static InputMethodSubtype findSubtypeByKeyboardLayoutSetLocale(
+            Context context, Locale locale) {
+        final String localeString = locale.toString();
+        final InputMethodInfo imi = SubtypeUtils.getInputMethodInfo(context.getPackageName());
+        final int count = imi.getSubtypeCount();
+        for (int i = 0; i < count; i++) {
+            final InputMethodSubtype subtype = imi.getSubtypeAt(i);
+            if (localeString.equals(KeyboardLayoutSet.getKeyboardLayoutSetLocaleString(subtype))) {
+                return subtype;
+            }
+        }
+        throw new RuntimeException("Can not find subtype of locale " + localeString);
+    }
 }
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index cd01bb1464fdcb28b72f06554b54291834c53a4a..1fc945f3c4ad5dc918feb1ba2e09cb9f30050578 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -37,7 +37,6 @@ import com.android.inputmethod.latin.Flag;
 import com.android.inputmethod.latin.LocaleUtils;
 import com.android.inputmethod.latin.R;
 import com.android.inputmethod.latin.StringUtils;
-import com.android.inputmethod.latin.SubtypeLocale;
 import com.android.inputmethod.latin.SynchronouslyLoadedContactsDictionary;
 import com.android.inputmethod.latin.SynchronouslyLoadedUserDictionary;
 import com.android.inputmethod.latin.WhitelistDictionary;
@@ -326,7 +325,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService
                 } else if (CAPITALIZE_FIRST == capitalizeType) {
                     for (int i = 0; i < mSuggestions.size(); ++i) {
                         // Likewise
-                        mSuggestions.set(i, SubtypeLocale.toTitleCase(
+                        mSuggestions.set(i, StringUtils.toTitleCase(
                                 mSuggestions.get(i).toString(), locale));
                     }
                 }
diff --git a/tests/src/com/android/inputmethod/latin/SubtypeLocaleTests.java b/tests/src/com/android/inputmethod/latin/SubtypeLocaleTests.java
index 6180ff5f94caf4398039868208d5c76385dd917c..4ac765782670bedc6316d8d7048a8bdb8937f4a6 100644
--- a/tests/src/com/android/inputmethod/latin/SubtypeLocaleTests.java
+++ b/tests/src/com/android/inputmethod/latin/SubtypeLocaleTests.java
@@ -22,6 +22,8 @@ import android.view.inputmethod.InputMethodInfo;
 import android.view.inputmethod.InputMethodManager;
 import android.view.inputmethod.InputMethodSubtype;
 
+import com.android.inputmethod.keyboard.KeyboardLayoutSet;
+
 import java.util.ArrayList;
 import java.util.Locale;
 
@@ -58,29 +60,17 @@ public class SubtypeLocaleTests extends AndroidTestCase {
         assertTrue("Can not find keyboard subtype", mSubtypesList.size() > 0);
     }
 
-    private static Locale getSubtypeLocale(InputMethodSubtype subtype) {
-        return LocaleUtils.constructLocaleFromString(subtype.getLocale());
-    }
-
-    private static Locale getKeyboardLocale(InputMethodSubtype subtype) {
-        final String subtypeLocaleString = subtype.containsExtraValueKey(
-                LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LOCALE)
-                ? subtype.getExtraValueOf(LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LOCALE)
-                : subtype.getLocale();
-        return LocaleUtils.constructLocaleFromString(subtypeLocaleString);
-    }
-
     public void testFullDisplayName() {
         final StringBuilder messages = new StringBuilder();
         int failedCount = 0;
         for (final InputMethodSubtype subtype : mSubtypesList) {
-            final Locale locale = getKeyboardLocale(subtype);
+            final Locale locale = KeyboardLayoutSet.getKeyboardLayoutSetLocale(subtype);
             if (locale.getLanguage().equals(SubtypeLocale.NO_LANGUAGE)) {
                 // This is special language name for language agnostic usage.
                 continue;
             }
             final String keyboardName = SubtypeLocale.getFullDisplayName(locale);
-            final String languageName = SubtypeLocale.toTitleCase(
+            final String languageName = StringUtils.toTitleCase(
                     locale.getDisplayLanguage(locale), locale);
             if (!keyboardName.contains(languageName)) {
                 failedCount++;
@@ -104,13 +94,13 @@ public class SubtypeLocaleTests extends AndroidTestCase {
         final StringBuilder messages = new StringBuilder();
         int failedCount = 0;
         for (final InputMethodSubtype subtype : mSubtypesList) {
-            final Locale locale = getKeyboardLocale(subtype);
+            final Locale locale = KeyboardLayoutSet.getKeyboardLayoutSetLocale(subtype);
             if (locale.getLanguage().equals(SubtypeLocale.NO_LANGUAGE)) {
                 // This is special language name for language agnostic usage.
                 continue;
             }
             final String keyboardName = SubtypeLocale.getMiddleDisplayName(locale);
-            final String languageName = SubtypeLocale.toTitleCase(
+            final String languageName = StringUtils.toTitleCase(
                     locale.getDisplayLanguage(locale), locale);
             if (!keyboardName.equals(languageName)) {
                 failedCount++;
@@ -131,13 +121,13 @@ public class SubtypeLocaleTests extends AndroidTestCase {
         final StringBuilder messages = new StringBuilder();
         int failedCount = 0;
         for (final InputMethodSubtype subtype : mSubtypesList) {
-            final Locale locale = getKeyboardLocale(subtype);
+            final Locale locale = KeyboardLayoutSet.getKeyboardLayoutSetLocale(subtype);
             if (locale.getCountry().equals(SubtypeLocale.QWERTY)) {
                 // This is special country code for QWERTY keyboard.
                 continue;
             }
             final String keyboardName = SubtypeLocale.getShortDisplayName(locale);
-            final String languageCode = SubtypeLocale.toTitleCase(locale.getLanguage(), locale);
+            final String languageCode = StringUtils.toTitleCase(locale.getLanguage(), locale);
             if (!keyboardName.equals(languageCode)) {
                 failedCount++;
                 messages.append(String.format(