diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index 3c0a9c1a2366962a1e167727107b87d5cda8ca63..66dc7d71c3ee81111920c6265d9ccc35e96ee647 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -242,6 +242,8 @@
 
     <!-- Description for Czech keyboard subtype [CHAR LIMIT=35] -->
     <string name="subtype_mode_cs_keyboard">Czech Keyboard</string>
+    <!-- Description for Arabic keyboard subtype [CHAR LIMIT=35] -->
+    <string name="subtype_mode_ar_keyboard">Arabic Keyboard</string>
     <!-- Description for Danish keyboard subtype [CHAR LIMIT=35] -->
     <string name="subtype_mode_da_keyboard">Danish Keyboard</string>
     <!-- Description for German keyboard subtype [CHAR LIMIT=35] -->
@@ -260,6 +262,9 @@
     <string name="subtype_mode_fr_CA_keyboard">French (Canada) Keyboard</string>
     <!-- Description for French (Switzerland) keyboard subtype [CHAR LIMIT=35] -->
     <string name="subtype_mode_fr_CH_keyboard">French (Switzerland) Keyboard</string>
+    <!-- Description for Hebrew keyboard subtype [CHAR LIMIT=35] -->
+    <!-- Java uses the deprecated "iw" code instead of the standard "he" code -->
+    <string name="subtype_mode_iw_keyboard">Hebrew Keyboard</string>
     <!-- Description for Italian keyboard subtype [CHAR LIMIT=35] -->
     <string name="subtype_mode_it_keyboard">Italian Keyboard</string>
     <!-- Description for Norwegian keyboard subtype [CHAR LIMIT=35] -->
diff --git a/java/res/xml-ar/kbd_qwerty.xml b/java/res/xml-ar/kbd_qwerty.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6bab20059bfdbc29cffff2cf9aeb6936927aaf29
--- /dev/null
+++ b/java/res/xml-ar/kbd_qwerty.xml
@@ -0,0 +1,34 @@
+<?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.
+*/
+-->
+
+<Keyboard
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+    latin:keyboardHeight="@dimen/keyboardHeight"
+    latin:maxKeyboardHeight="50%p"
+    latin:rowHeight="25%p"
+    latin:keyWidth="10%p"
+    latin:horizontalGap="@dimen/key_horizontal_gap"
+    latin:verticalGap="@dimen/key_bottom_gap"
+    latin:popupKeyboardTemplate="@xml/kbd_popup_template"
+    latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
+>
+    <include
+        latin:keyboardLayout="@xml/kbd_ar_rows" />
+</Keyboard>
diff --git a/java/res/xml-iw/kbd_qwerty.xml b/java/res/xml-iw/kbd_qwerty.xml
index 98bfd7e0b2d09d68be179fe025a3eb061de57f9d..2c3906f6a3d8330ea3e09518ab4329eb4c536037 100644
--- a/java/res/xml-iw/kbd_qwerty.xml
+++ b/java/res/xml-iw/kbd_qwerty.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-/* 
+/*
 **
 ** Copyright 2010, The Android Open Source Project
 **
@@ -30,83 +30,5 @@
     latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
 >
     <include
-        latin:keyboardLayout="@xml/kbd_key_styles" />
-    <Row
-        latin:rowEdgeFlags="top"
-    >
-        <Spacer
-            latin:horizontalGap="5%p" />
-        <Key
-            latin:keyLabel="ק"
-            latin:keyEdgeFlags="left" />
-        <Key
-            latin:keyLabel="ר" />
-        <Key
-            latin:keyLabel="א" />
-        <Key
-            latin:keyLabel="ט" />
-        <Key
-            latin:keyLabel="ו" />
-        <Key
-            latin:keyLabel="ן" />
-        <Key
-            latin:keyLabel="ם" />
-        <Key
-            latin:keyLabel="פ" />
-        <Spacer
-            latin:horizontalGap="1.25%p" />
-        <Key
-            latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="13.75%p"
-            latin:keyEdgeFlags="right" />
-    </Row>
-    <Row>
-        <Key
-            latin:keyLabel="ש"
-            latin:keyEdgeFlags="left" />
-        <Key
-            latin:keyLabel="ד" />
-        <Key
-            latin:keyLabel="×’" />
-        <Key
-            latin:keyLabel="×›" />
-        <Key
-            latin:keyLabel="×¢" />
-        <Key
-            latin:keyLabel="×™" />
-        <Key
-            latin:keyLabel="×—" />
-        <Key
-            latin:keyLabel="ל" />
-        <Key
-            latin:keyLabel="ך" />
-        <Key
-            latin:keyLabel="×£"
-            latin:keyEdgeFlags="right" />
-    </Row>
-    <Row>
-        <Spacer
-            latin:horizontalGap="5%p" />
-        <Key
-            latin:keyLabel="×–"
-            latin:keyEdgeFlags="left" />
-        <Key
-            latin:keyLabel="ס" />
-        <Key
-            latin:keyLabel="ב" />
-        <Key
-            latin:keyLabel="×”" />
-        <Key
-            latin:keyLabel="× " />
-        <Key
-            latin:keyLabel="מ" />
-        <Key
-            latin:keyLabel="צ" />
-        <Key
-            latin:keyLabel="ת" />
-        <Key
-            latin:keyLabel="×¥"
-            latin:keyEdgeFlags="right" />
-    </Row>
-    <include latin:keyboardLayout="@xml/kbd_qwerty_row4" />
+        latin:keyboardLayout="@xml/kbd_iw_rows" />
 </Keyboard>
diff --git a/java/res/xml-xlarge/kbd_ar_rows.xml b/java/res/xml-xlarge/kbd_ar_rows.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9243a99f8157b6c07443ad6db2fa70446746bd60
--- /dev/null
+++ b/java/res/xml-xlarge/kbd_ar_rows.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <include
+        latin:keyboardLayout="@xml/kbd_key_styles" />
+    <Row
+        latin:keyWidth="7.49%p"
+    >
+        <Key
+            latin:keyStyle="tabKeyStyle"
+            latin:keyLabelOption="alignLeft"
+            latin:keyWidth="7.949%p"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="ض" />
+        <Key
+            latin:keyLabel="ص" />
+        <Key
+            latin:keyLabel="Ø«" />
+        <Key
+            latin:keyLabel="Ù‚" />
+        <Key
+            latin:keyLabel="ف"
+            latin:popupCharacters="ف,ڤ" />
+        <Key
+            latin:keyLabel="غ" />
+        <Key
+            latin:keyLabel="ع" />
+        <Key
+            latin:keyLabel="Ù‡"
+            latin:popupCharacters="ه,هـ" />
+        <Key
+            latin:keyLabel="Ø®" />
+        <Key
+            latin:keyLabel="Ø­" />
+        <Key
+            latin:keyLabel="ج"
+            latin:popupCharacters="ج,چ" />
+        <Key
+            latin:keyStyle="deleteKeyStyle"
+            latin:keyWidth="9.331%p"
+            latin:keyEdgeFlags="right" />
+    </Row>
+    <Row
+        latin:keyWidth="7.49%p"
+    >
+        <Key
+            latin:keyStyle="toSymbolKeyStyle"
+            latin:keyLabelOption="alignLeft"
+            latin:keyWidth="7.949%p"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="Ø´" />
+        <Key
+            latin:keyLabel="س" />
+        <Key
+            latin:keyLabel="ÙŠ" />
+        <Key
+            latin:keyLabel="ب"
+            latin:popupCharacters="ب,پ" />
+        <Key
+            latin:keyLabel="Ù„"
+            latin:popupCharacters="ل,لا" />
+        <Key
+            latin:keyLabel="ا"
+            latin:popupCharacters="ا,أ,إ,آ" />
+        <Key
+            latin:keyLabel="ت" />
+        <Key
+            latin:keyLabel="Ù†" />
+        <Key
+            latin:keyLabel="Ù…" />
+        <Key
+            latin:keyLabel="Ùƒ"
+            latin:popupCharacters="Ùƒ,Ú¯" />
+        <Key
+            latin:keyLabel="Ø·" />
+        <Key
+            latin:keyStyle="returnKeyStyle"
+            latin:keyWidth="8.593%p"
+            latin:keyEdgeFlags="right" />
+    </Row>
+    <Row
+        latin:keyWidth="8.042%p"
+    >
+        <Key
+            latin:keyLabel="ئ"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="Ø¡" />
+        <Key
+            latin:keyLabel="ؤ" />
+        <Key
+            latin:keyLabel="ر" />
+        <Key
+            latin:keyLabel="Ø°" />
+        <Key
+            latin:keyLabel="Ù‰" />
+        <Key
+            latin:keyLabel="Ø©" />
+        <Key
+            latin:keyLabel="Ùˆ" />
+        <Key
+            latin:keyLabel="ز"
+            latin:popupCharacters="ز,ژ" />
+        <Key
+            latin:keyLabel="ظ" />
+        <Key
+            latin:keyLabel="د" />
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyWidth="11.736%p"
+            latin:keyEdgeFlags="right" />
+    </Row>
+    <include latin:keyboardLayout="@xml/kbd_qwerty_row4" />
+</merge>
diff --git a/java/res/xml-xlarge/kbd_iw_rows.xml b/java/res/xml-xlarge/kbd_iw_rows.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a3a239dbf66f082cc4da668b8c0289ab01ff5d47
--- /dev/null
+++ b/java/res/xml-xlarge/kbd_iw_rows.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <include
+        latin:keyboardLayout="@xml/kbd_key_styles" />
+    <Row
+        latin:keyWidth="8.272%p"
+    >
+        <Key
+            latin:keyStyle="tabKeyStyle"
+            latin:keyLabelOption="alignLeft"
+            latin:keyWidth="7.949%p"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="," />
+        <Key
+            latin:keyLabel="." />
+        <Key
+            latin:keyLabel="ק" />
+        <Key
+            latin:keyLabel="ר" />
+        <Key
+            latin:keyLabel="א" />
+        <Key
+            latin:keyLabel="ט" />
+        <Key
+            latin:keyLabel="ו" />
+        <Key
+            latin:keyLabel="ן" />
+        <Key
+            latin:keyLabel="ם" />
+        <Key
+            latin:keyLabel="פ" />
+        <Key
+            latin:keyStyle="deleteKeyStyle"
+            latin:keyWidth="9.331%p"
+            latin:keyEdgeFlags="right" />
+    </Row>
+    <Row
+        latin:keyWidth="8.157%p"
+    >
+        <Key
+            latin:keyStyle="toSymbolKeyStyle"
+            latin:keyLabelOption="alignLeft"
+            latin:keyWidth="10.167%p"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="ש" />
+        <Key
+            latin:keyLabel="ד" />
+        <Key
+            latin:keyLabel="×’"
+            latin:popupCharacters="ג,ג׳" />
+        <Key
+            latin:keyLabel="×›" />
+        <Key
+            latin:keyLabel="×¢" />
+        <Key
+            latin:keyLabel="×™"
+            latin:popupCharacters="י,ײַ" />
+        <Key
+            latin:keyLabel="×—"
+            latin:popupCharacters="ח,ח׳" />
+        <Key
+            latin:keyLabel="ל" />
+        <Key
+            latin:keyLabel="ך" />
+        <Key
+            latin:keyLabel="×£" />
+        <Key
+            latin:keyStyle="returnKeyStyle"
+            latin:keyWidth="8.593%p"
+            latin:keyEdgeFlags="right" />
+    </Row>
+    <Row
+        latin:keyWidth="8.042%p"
+    >
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyWidth="15.192%p"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="×–"
+            latin:popupCharacters="ז,ז׳" />
+        <Key
+            latin:keyLabel="ס" />
+        <Key
+            latin:keyLabel="ב" />
+        <Key
+            latin:keyLabel="×”" />
+        <Key
+            latin:keyLabel="× " />
+        <Key
+            latin:keyLabel="מ" />
+        <Key
+            latin:keyLabel="צ"
+            latin:popupCharacters="צ,צ׳" />
+        <Key
+            latin:keyLabel="ת"
+            latin:popupCharacters="ת,ת׳" />
+        <Key
+            latin:keyLabel="×¥"
+            latin:popupCharacters="ץ,ץ׳" />
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyWidth="12.530%p"
+            latin:keyEdgeFlags="right" />
+    </Row>
+    <include latin:keyboardLayout="@xml/kbd_qwerty_row4" />
+</merge>
diff --git a/java/res/xml/kbd_iw_rows.xml b/java/res/xml/kbd_iw_rows.xml
new file mode 100644
index 0000000000000000000000000000000000000000..bfd236468b0439a95f583267249596a36c0644db
--- /dev/null
+++ b/java/res/xml/kbd_iw_rows.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <include
+        latin:keyboardLayout="@xml/kbd_key_styles" />
+    <Row
+        latin:rowEdgeFlags="top"
+    >
+        <Spacer
+            latin:horizontalGap="5%p" />
+        <Key
+            latin:keyLabel="ק"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="ר" />
+        <Key
+            latin:keyLabel="א" />
+        <Key
+            latin:keyLabel="ט" />
+        <Key
+            latin:keyLabel="ו" />
+        <Key
+            latin:keyLabel="ן" />
+        <Key
+            latin:keyLabel="ם" />
+        <Key
+            latin:keyLabel="פ" />
+        <Spacer
+            latin:horizontalGap="1.25%p" />
+        <Key
+            latin:keyStyle="deleteKeyStyle"
+            latin:keyWidth="13.75%p"
+            latin:keyEdgeFlags="right" />
+    </Row>
+    <Row>
+        <Key
+            latin:keyLabel="ש"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="ד" />
+        <Key
+            latin:keyLabel="×’" />
+        <Key
+            latin:keyLabel="×›" />
+        <Key
+            latin:keyLabel="×¢" />
+        <Key
+            latin:keyLabel="×™" />
+        <Key
+            latin:keyLabel="×—" />
+        <Key
+            latin:keyLabel="ל" />
+        <Key
+            latin:keyLabel="ך" />
+        <Key
+            latin:keyLabel="×£"
+            latin:keyEdgeFlags="right" />
+    </Row>
+    <Row>
+        <Spacer
+            latin:horizontalGap="5%p" />
+        <Key
+            latin:keyLabel="×–"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="ס" />
+        <Key
+            latin:keyLabel="ב" />
+        <Key
+            latin:keyLabel="×”" />
+        <Key
+            latin:keyLabel="× " />
+        <Key
+            latin:keyLabel="מ" />
+        <Key
+            latin:keyLabel="צ" />
+        <Key
+            latin:keyLabel="ת" />
+        <Key
+            latin:keyLabel="×¥"
+            latin:keyEdgeFlags="right" />
+    </Row>
+    <include latin:keyboardLayout="@xml/kbd_qwerty_row4" />
+</merge>
diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml
index 8dec7abec3e4036ccf6902a73d1354bf768c12db..69f8d026d6fcd0dfe6fbd14fe30ed037c3946aac 100644
--- a/java/res/xml/method.xml
+++ b/java/res/xml/method.xml
@@ -45,6 +45,11 @@
             android:imeSubtypeLocale="en_GB"
             android:imeSubtypeMode="keyboard"
     />
+    <subtype android:icon="@drawable/ic_subtype_keyboard"
+            android:label="@string/subtype_mode_ar_keyboard"
+            android:imeSubtypeLocale="ar"
+            android:imeSubtypeMode="keyboard"
+    />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_mode_cs_keyboard"
             android:imeSubtypeLocale="cs"
@@ -110,6 +115,12 @@
             android:imeSubtypeLocale="it"
             android:imeSubtypeMode="keyboard"
     />
+    <!-- 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_mode_iw_keyboard"
+            android:imeSubtypeLocale="iw"
+            android:imeSubtypeMode="keyboard"
+    />
     <subtype android:icon="@drawable/ic_subtype_mic"
             android:label="@string/subtype_mode_it_voice"
             android:imeSubtypeLocale="it"