Make View respect LAYOUT_DIRECTION_LOCALE

- update also unit tests for taking care of the locale direction
- code formatting on the layout test files

Change-Id: I4037eac3c572de9abb0178f36ca03803cc2c1522
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 30ac3f7..441cdc1 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -76,6 +76,7 @@
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Locale;
 import java.util.WeakHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 
@@ -8665,7 +8666,7 @@
 
     /**
      * Resolving the layout direction. LTR is set initially.
-     * We are supposing here that the parent directionality will be resolved before its children
+     * We are supposing here that the parent directionality will be resolved before its children.
      */
     private void resolveLayoutDirection() {
         mPrivateFlags2 &= ~RESOLVED_LAYOUT_RTL;
@@ -8680,6 +8681,34 @@
             case LAYOUT_DIRECTION_RTL:
                 mPrivateFlags2 |= RESOLVED_LAYOUT_RTL;
                 break;
+            case LAYOUT_DIRECTION_LOCALE:
+                if(isLayoutDirectionRtl(Locale.getDefault())) {
+                    mPrivateFlags2 |= RESOLVED_LAYOUT_RTL;
+                }
+                break;
+            default:
+                // Nothing to do, LTR by default
+        }
+    }
+
+    /**
+     * Check if a Locale is corresponding to a RTL script.
+     *
+     * @param locale Locale to check
+     * @return true if a Locale is corresponding to a RTL script.
+     */
+    private static boolean isLayoutDirectionRtl(Locale locale) {
+        if (locale == null || locale.equals(Locale.ROOT)) return false;
+        // Be careful: this code will need to be changed when vertical scripts will be supported
+        // OR if ICU4C is updated to have the "likelySubtags" file
+        switch(Character.getDirectionality(locale.getDisplayName(locale).charAt(0))) {
+            case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
+                return false;
+            case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
+            case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
+                return true;
+            default:
+                return false;
         }
     }
 
diff --git a/tests/BiDiTests/Android b/tests/BiDiTests/Android
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/BiDiTests/Android
diff --git a/tests/BiDiTests/AndroidManifest.xml b/tests/BiDiTests/AndroidManifest.xml
index ad27a62..135c5dd 100644
--- a/tests/BiDiTests/AndroidManifest.xml
+++ b/tests/BiDiTests/AndroidManifest.xml
@@ -57,6 +57,13 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".BiDiTestLinearLayoutLocaleActivity"
+                  android:windowSoftInputMode="stateAlwaysHidden">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+            </intent-filter>
+        </activity>
+
         <activity android:name=".BiDiTestFrameLayoutLtrActivity"
                   android:windowSoftInputMode="stateAlwaysHidden">
             <intent-filter>
@@ -71,6 +78,13 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".BiDiTestFrameLayoutLocaleActivity"
+                  android:windowSoftInputMode="stateAlwaysHidden">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+            </intent-filter>
+        </activity>
+
         <activity android:name=".BiDiTestRelativeLayoutLtrActivity"
                   android:windowSoftInputMode="stateAlwaysHidden">
             <intent-filter>
@@ -99,6 +113,13 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".BiDiTestRelativeLayoutLocaleActivity2"
+                  android:windowSoftInputMode="stateAlwaysHidden">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+            </intent-filter>
+        </activity>
+
         <activity android:name=".BiDiTestTableLayoutLtrActivity"
                   android:windowSoftInputMode="stateAlwaysHidden">
             <intent-filter>
@@ -113,6 +134,13 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".BiDiTestTableLayoutLocaleActivity"
+                  android:windowSoftInputMode="stateAlwaysHidden">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+            </intent-filter>
+        </activity>
+
     </application>
 
 </manifest>
diff --git a/tests/BiDiTests/res/layout/basic.xml b/tests/BiDiTests/res/layout/basic.xml
index f254e3c..d5f5ba7 100644
--- a/tests/BiDiTests/res/layout/basic.xml
+++ b/tests/BiDiTests/res/layout/basic.xml
@@ -15,34 +15,34 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent">
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content">
+                  android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content">
 
-       <Button android:id="@+id/button"
-               android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button_text"
-               android:textSize="32dip"
-        />
+        <Button android:id="@+id/button"
+                android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button_text"
+                android:textSize="32dip"
+                />
 
         <TextView android:id="@+id/textview"
-              android:layout_height="wrap_content"
-              android:layout_width="wrap_content"
-              android:textSize="32dip"
-              android:text="@string/textview_text"
-        />
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="32dip"
+                  android:text="@string/textview_text"
+                />
 
         <EditText android:id="@+id/edittext"
-              android:layout_height="wrap_content"
-              android:layout_width="match_parent"
-              android:textSize="32dip"
-        />
+                  android:layout_height="wrap_content"
+                  android:layout_width="match_parent"
+                  android:textSize="32dip"
+                />
 
     </LinearLayout>
 
diff --git a/tests/BiDiTests/res/layout/canvas.xml b/tests/BiDiTests/res/layout/canvas.xml
index 77007af3..03b1bb2 100644
--- a/tests/BiDiTests/res/layout/canvas.xml
+++ b/tests/BiDiTests/res/layout/canvas.xml
@@ -15,20 +15,20 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent">
 
     <SeekBar android:id="@+id/seekbar"
-               android:layout_height="wrap_content"
-               android:layout_width="match_parent"
-               />
+             android:layout_height="wrap_content"
+             android:layout_width="match_parent"
+            />
 
     <view class="com.android.bidi.BiDiTestView"
-        android:id="@+id/testview"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:background="#FF0000"
-    />
+          android:id="@+id/testview"
+          android:layout_width="match_parent"
+          android:layout_height="wrap_content"
+          android:background="#FF0000"
+            />
 
 </LinearLayout>
diff --git a/tests/BiDiTests/res/layout/frame_layout_locale.xml b/tests/BiDiTests/res/layout/frame_layout_locale.xml
new file mode 100644
index 0000000..812e0dc
--- /dev/null
+++ b/tests/BiDiTests/res/layout/frame_layout_locale.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+             android:id="@+id/frame_layout_ltr"
+             android:layout_width="match_parent"
+             android:layout_height="match_parent"
+             android:layoutDirection="locale"
+             android:background="#FF000000">
+
+    <FrameLayout
+            android:layout_width="100dp"
+            android:layout_height="100dp"
+            android:layout_gravity="right|center_vertical"
+            android:background="#FFFF0000">
+    </FrameLayout>
+
+    <FrameLayout
+            android:layout_width="100dp"
+            android:layout_height="100dp"
+            android:layout_gravity="left|center_vertical"
+            android:background="#FF00FF00">
+    </FrameLayout>
+
+    <FrameLayout
+            android:layout_width="100dp"
+            android:layout_height="100dp"
+            android:layout_gravity="top|center_horizontal"
+            android:background="#FF0000FF">
+    </FrameLayout>
+
+    <FrameLayout
+            android:layout_width="100dp"
+            android:layout_height="100dp"
+            android:layout_gravity="bottom|center_horizontal"
+            android:background="#FF00FFFF">
+    </FrameLayout>
+
+    <FrameLayout
+            android:layout_width="100dp"
+            android:layout_height="100dp"
+            android:layout_gravity="top|start"
+            android:background="#FFFFFFFF">
+    </FrameLayout>
+
+    <FrameLayout
+            android:layout_width="100dp"
+            android:layout_height="100dp"
+            android:layout_gravity="top|end"
+            android:background="#FFFFFF00">
+    </FrameLayout>
+
+    <FrameLayout
+            android:layout_width="100dp"
+            android:layout_height="100dp"
+            android:layout_gravity="bottom|start"
+            android:background="#FFFFFFFF">
+    </FrameLayout>
+
+    <FrameLayout
+            android:layout_width="100dp"
+            android:layout_height="100dp"
+            android:layout_gravity="bottom|end"
+            android:background="#FFFFFF00">
+    </FrameLayout>
+
+    <FrameLayout
+            android:layout_width="100dp"
+            android:layout_height="100dp"
+            android:layout_gravity="center_horizontal|center_vertical"
+            android:background="#FF888888">
+    </FrameLayout>
+
+</FrameLayout>
+
diff --git a/tests/BiDiTests/res/layout/frame_layout_ltr.xml b/tests/BiDiTests/res/layout/frame_layout_ltr.xml
index 61fd06e..79effe6 100644
--- a/tests/BiDiTests/res/layout/frame_layout_ltr.xml
+++ b/tests/BiDiTests/res/layout/frame_layout_ltr.xml
@@ -15,74 +15,74 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/frame_layout_ltr"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layoutDirection="ltr"
-    android:background="#FF000000">
+             android:id="@+id/frame_layout_ltr"
+             android:layout_width="match_parent"
+             android:layout_height="match_parent"
+             android:layoutDirection="ltr"
+             android:background="#FF000000">
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="right|center_vertical"
             android:background="#FFFF0000">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="left|center_vertical"
             android:background="#FF00FF00">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="top|center_horizontal"
             android:background="#FF0000FF">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="bottom|center_horizontal"
             android:background="#FF00FFFF">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="top|start"
             android:background="#FFFFFFFF">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="top|end"
             android:background="#FFFFFF00">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="bottom|start"
             android:background="#FFFFFFFF">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="bottom|end"
             android:background="#FFFFFF00">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="center_horizontal|center_vertical"
             android:background="#FF888888">
-        </FrameLayout>
+    </FrameLayout>
 
 </FrameLayout>
 
diff --git a/tests/BiDiTests/res/layout/frame_layout_rtl.xml b/tests/BiDiTests/res/layout/frame_layout_rtl.xml
index 598b41a..a793862 100644
--- a/tests/BiDiTests/res/layout/frame_layout_rtl.xml
+++ b/tests/BiDiTests/res/layout/frame_layout_rtl.xml
@@ -15,74 +15,74 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/frame_layout_ltr"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layoutDirection="rtl"
-    android:background="#FF000000">
+             android:id="@+id/frame_layout_ltr"
+             android:layout_width="match_parent"
+             android:layout_height="match_parent"
+             android:layoutDirection="rtl"
+             android:background="#FF000000">
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="right|center_vertical"
             android:background="#FFFF0000">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="left|center_vertical"
             android:background="#FF00FF00">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="top|center_horizontal"
             android:background="#FF0000FF">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="bottom|center_horizontal"
             android:background="#FF00FFFF">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="top|start"
             android:background="#FFFFFFFF">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="top|end"
             android:background="#FFFFFF00">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="bottom|start"
             android:background="#FFFFFFFF">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="bottom|end"
             android:background="#FFFFFF00">
-        </FrameLayout>
+    </FrameLayout>
 
-        <FrameLayout
+    <FrameLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="center_horizontal|center_vertical"
             android:background="#FF888888">
-        </FrameLayout>
+    </FrameLayout>
 
 </FrameLayout>
 
diff --git a/tests/BiDiTests/res/layout/linear_layout_locale.xml b/tests/BiDiTests/res/layout/linear_layout_locale.xml
new file mode 100644
index 0000000..72046cb
--- /dev/null
+++ b/tests/BiDiTests/res/layout/linear_layout_locale.xml
@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:id="@+id/linear_layout_rtl"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:layoutDirection="locale">
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content">
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
+
+        <TextView android:id="@+id/textview"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="24dip"
+                  android:text="@string/textview_text"
+                />
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button2_text"
+                android:textSize="24dip"
+                />
+    </LinearLayout>
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="inherit">
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
+
+        <TextView android:id="@+id/textview"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="24dip"
+                  android:text="@string/textview_text"
+                />
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button2_text"
+                android:textSize="24dip"
+                />
+    </LinearLayout>
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="ltr">
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
+
+        <TextView android:id="@+id/textview"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="24dip"
+                  android:text="@string/textview_text"
+                />
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button2_text"
+                android:textSize="24dip"
+                />
+    </LinearLayout>
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="rtl">
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
+
+        <TextView android:id="@+id/textview"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="24dip"
+                  android:text="@string/textview_text"
+                />
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button2_text"
+                android:textSize="24dip"
+                />
+    </LinearLayout>
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="locale">
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
+
+        <TextView android:id="@+id/textview"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="24dip"
+                  android:text="@string/textview_text"
+                />
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button2_text"
+                android:textSize="24dip"
+                />
+    </LinearLayout>
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="inherit">
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
+
+        <TextView android:id="@+id/textview"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="24dip"
+                  android:text="@string/textview_text"
+                />
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button2_text"
+                android:textSize="24dip"
+                />
+    </LinearLayout>
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="ltr">
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
+
+        <TextView android:id="@+id/textview"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="24dip"
+                  android:text="@string/textview_text"
+                />
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button2_text"
+                android:textSize="24dip"
+                />
+    </LinearLayout>
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="rtl">
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
+
+        <TextView android:id="@+id/textview"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="24dip"
+                  android:text="@string/textview_text"
+                />
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button2_text"
+                android:textSize="24dip"
+                />
+    </LinearLayout>
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="locale">
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
+
+        <TextView android:id="@+id/textview"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="24dip"
+                  android:text="@string/textview_text"
+                />
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button2_text"
+                android:textSize="24dip"
+                />
+    </LinearLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/linear_layout_ltr.xml b/tests/BiDiTests/res/layout/linear_layout_ltr.xml
index d4386f2..bea087e 100644
--- a/tests/BiDiTests/res/layout/linear_layout_ltr.xml
+++ b/tests/BiDiTests/res/layout/linear_layout_ltr.xml
@@ -15,198 +15,243 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/linear_layout_ltr"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layoutDirection="ltr">
+              android:id="@+id/linear_layout_ltr"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:layoutDirection="ltr">
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="horizontal"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content">
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
-
+                />
     </LinearLayout>
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="horizontal"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layoutDirection="inherit">
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="inherit">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
-
+                />
     </LinearLayout>
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="horizontal"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layoutDirection="ltr">
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="ltr">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
-
+                />
     </LinearLayout>
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="horizontal"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layoutDirection="rtl">
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="rtl">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
-
+                />
     </LinearLayout>
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layoutDirection="inherit">
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="locale">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
-
+                />
     </LinearLayout>
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layoutDirection="ltr">
+                  android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="inherit">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
-
+                />
     </LinearLayout>
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layoutDirection="rtl">
+                  android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="ltr">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
+                />
+    </LinearLayout>
 
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="rtl">
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
+
+        <TextView android:id="@+id/textview"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="24dip"
+                  android:text="@string/textview_text"
+                />
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button2_text"
+                android:textSize="24dip"
+                />
+    </LinearLayout>
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="locale">
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
+
+        <TextView android:id="@+id/textview"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="24dip"
+                  android:text="@string/textview_text"
+                />
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button2_text"
+                android:textSize="24dip"
+                />
     </LinearLayout>
 
 </LinearLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/linear_layout_rtl.xml b/tests/BiDiTests/res/layout/linear_layout_rtl.xml
index 9d07263..12f14ef 100644
--- a/tests/BiDiTests/res/layout/linear_layout_rtl.xml
+++ b/tests/BiDiTests/res/layout/linear_layout_rtl.xml
@@ -15,198 +15,243 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/linear_layout_rtl"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layoutDirection="rtl">
+              android:id="@+id/linear_layout_rtl"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:layoutDirection="rtl">
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="horizontal"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content">
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
-
+                />
     </LinearLayout>
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="horizontal"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layoutDirection="inherit">
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="inherit">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
-
+                />
     </LinearLayout>
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="horizontal"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layoutDirection="ltr">
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="ltr">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
-
+                />
     </LinearLayout>
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="horizontal"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layoutDirection="rtl">
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="rtl">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
-
+                />
     </LinearLayout>
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layoutDirection="inherit">
+                  android:orientation="horizontal"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="locale">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
-
+                />
     </LinearLayout>
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layoutDirection="ltr">
+                  android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="inherit">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
-
+                />
     </LinearLayout>
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layoutDirection="rtl">
+                  android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="ltr">
 
-       <Button android:layout_height="wrap_content"
-               android:layout_width="wrap_content"
-               android:text="@string/button1_text"
-               android:textSize="24dip"
-        />
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
 
         <TextView android:id="@+id/textview"
                   android:layout_height="wrap_content"
                   android:layout_width="wrap_content"
                   android:textSize="24dip"
                   android:text="@string/textview_text"
-        />
+                />
 
         <Button android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:text="@string/button2_text"
                 android:textSize="24dip"
-         />
+                />
+    </LinearLayout>
 
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="rtl">
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
+
+        <TextView android:id="@+id/textview"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="24dip"
+                  android:text="@string/textview_text"
+                />
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button2_text"
+                android:textSize="24dip"
+                />
+    </LinearLayout>
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layoutDirection="locale">
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button1_text"
+                android:textSize="24dip"
+                />
+
+        <TextView android:id="@+id/textview"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:textSize="24dip"
+                  android:text="@string/textview_text"
+                />
+
+        <Button android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/button2_text"
+                android:textSize="24dip"
+                />
     </LinearLayout>
 
 </LinearLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/main.xml b/tests/BiDiTests/res/layout/main.xml
index e39d1d6..eb73d44 100644
--- a/tests/BiDiTests/res/layout/main.xml
+++ b/tests/BiDiTests/res/layout/main.xml
@@ -15,26 +15,26 @@
 -->
 
 <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@android:id/tabhost"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+         android:id="@android:id/tabhost"
+         android:layout_width="fill_parent"
+         android:layout_height="fill_parent">
 
     <LinearLayout
-        android:orientation="vertical"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:padding="5dp">
-
-        <TabWidget
-            android:id="@android:id/tabs"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content" />
-
-        <FrameLayout
-            android:id="@android:id/tabcontent"
+            android:orientation="vertical"
             android:layout_width="fill_parent"
             android:layout_height="fill_parent"
-            android:padding="5dp" />
+            android:padding="5dp">
+
+        <TabWidget
+                android:id="@android:id/tabs"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"/>
+
+        <FrameLayout
+                android:id="@android:id/tabcontent"
+                android:layout_width="fill_parent"
+                android:layout_height="fill_parent"
+                android:padding="5dp"/>
 
     </LinearLayout>
 
diff --git a/tests/BiDiTests/res/layout/relative_layout_2_locale.xml b/tests/BiDiTests/res/layout/relative_layout_2_locale.xml
new file mode 100644
index 0000000..c99a99b
--- /dev/null
+++ b/tests/BiDiTests/res/layout/relative_layout_2_locale.xml
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:id="@+id/relative_layout_ltr"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:layoutDirection="locale">
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px">
+
+        <TextView android:id="@+id/label_1"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_1"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_1"/>
+
+        <Button android:id="@+id/ok_1"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_1"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_1"
+                android:layout_alignTop="@id/ok_1"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px"
+                    android:layoutDirection="ltr">
+
+        <TextView android:id="@+id/label_2"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_2"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_2"/>
+
+        <Button android:id="@+id/ok_2"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_2"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_2"
+                android:layout_alignTop="@id/ok_2"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px"
+                    android:layoutDirection="inherit">
+
+        <TextView android:id="@+id/label_3"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_3"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_3"/>
+
+        <Button android:id="@+id/ok_3"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_3"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_3"
+                android:layout_alignTop="@id/ok_3"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px"
+                    android:layoutDirection="rtl">
+
+        <TextView android:id="@+id/label_4"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_4"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_4"/>
+
+        <Button android:id="@+id/ok_4"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_4"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_4"
+                android:layout_alignTop="@id/ok_4"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px"
+                    android:layoutDirection="locale">
+
+        <TextView android:id="@+id/label_4"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_4"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_4"/>
+
+        <Button android:id="@+id/ok_4"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_4"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_4"
+                android:layout_alignTop="@id/ok_4"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/relative_layout_2_ltr.xml b/tests/BiDiTests/res/layout/relative_layout_2_ltr.xml
new file mode 100644
index 0000000..c4cab11
--- /dev/null
+++ b/tests/BiDiTests/res/layout/relative_layout_2_ltr.xml
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:id="@+id/relative_layout_ltr"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:layoutDirection="ltr">
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px">
+
+        <TextView android:id="@+id/label_1"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_1"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_1"/>
+
+        <Button android:id="@+id/ok_1"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_1"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_1"
+                android:layout_alignTop="@id/ok_1"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px"
+                    android:layoutDirection="ltr">
+
+        <TextView android:id="@+id/label_2"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_2"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_2"/>
+
+        <Button android:id="@+id/ok_2"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_2"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_2"
+                android:layout_alignTop="@id/ok_2"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px"
+                    android:layoutDirection="inherit">
+
+        <TextView android:id="@+id/label_3"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_3"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_3"/>
+
+        <Button android:id="@+id/ok_3"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_3"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_3"
+                android:layout_alignTop="@id/ok_3"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px"
+                    android:layoutDirection="rtl">
+
+        <TextView android:id="@+id/label_4"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_4"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_4"/>
+
+        <Button android:id="@+id/ok_4"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_4"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_4"
+                android:layout_alignTop="@id/ok_4"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px"
+                    android:layoutDirection="locale">
+
+        <TextView android:id="@+id/label_4"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_4"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_4"/>
+
+        <Button android:id="@+id/ok_4"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_4"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_4"
+                android:layout_alignTop="@id/ok_4"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/relative_layout_2_rtl.xml b/tests/BiDiTests/res/layout/relative_layout_2_rtl.xml
new file mode 100644
index 0000000..009d442
--- /dev/null
+++ b/tests/BiDiTests/res/layout/relative_layout_2_rtl.xml
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:id="@+id/relative_layout_ltr"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:layoutDirection="rtl">
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px">
+
+        <TextView android:id="@+id/label_1"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_1"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_1"/>
+
+        <Button android:id="@+id/ok_1"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_1"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_1"
+                android:layout_alignTop="@id/ok_1"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px"
+                    android:layoutDirection="ltr">
+
+        <TextView android:id="@+id/label_2"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_2"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_2"/>
+
+        <Button android:id="@+id/ok_2"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_2"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_2"
+                android:layout_alignTop="@id/ok_2"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px"
+                    android:layoutDirection="inherit">
+
+        <TextView android:id="@+id/label_3"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_3"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_3"/>
+
+        <Button android:id="@+id/ok_3"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_3"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_3"
+                android:layout_alignTop="@id/ok_3"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px"
+                    android:layoutDirection="rtl">
+
+        <TextView android:id="@+id/label_4"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_4"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_4"/>
+
+        <Button android:id="@+id/ok_4"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_4"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_4"
+                android:layout_alignTop="@id/ok_4"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="#FF000000"
+                    android:padding="10px"
+                    android:layoutDirection="locale">
+
+        <TextView android:id="@+id/label_4"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:text="Type here:"/>
+
+        <EditText android:id="@+id/entry_4"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_below="@id/label_4"/>
+
+        <Button android:id="@+id/ok_4"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/entry_4"
+                android:layout_alignParentRight="true"
+                android:layout_marginLeft="10px"
+                android:text="OK"/>
+
+        <Button android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@id/ok_4"
+                android:layout_alignTop="@id/ok_4"
+                android:text="Cancel"/>
+    </RelativeLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/relative_layout_ltr.xml b/tests/BiDiTests/res/layout/relative_layout_ltr.xml
index d789707..e9e8661 100644
--- a/tests/BiDiTests/res/layout/relative_layout_ltr.xml
+++ b/tests/BiDiTests/res/layout/relative_layout_ltr.xml
@@ -15,74 +15,74 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/frame_layout_ltr"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layoutDirection="ltr"
-    android:background="#FF000000">
+             android:id="@+id/frame_layout_ltr"
+             android:layout_width="match_parent"
+             android:layout_height="match_parent"
+             android:layoutDirection="ltr"
+             android:background="#FF000000">
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="right|center_vertical"
             android:background="#FFFF0000">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="left|center_vertical"
             android:background="#FF00FF00">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="top|center_horizontal"
             android:background="#FF0000FF">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="bottom|center_horizontal"
             android:background="#FF00FFFF">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="top|start"
             android:background="#FFFFFFFF">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="top|end"
             android:background="#FFFFFF00">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="bottom|start"
             android:background="#FFFFFFFF">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="bottom|end"
             android:background="#FFFFFF00">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="center_horizontal|center_vertical"
             android:background="#FF888888">
-        </RelativeLayout>
+    </RelativeLayout>
 
 </FrameLayout>
 
diff --git a/tests/BiDiTests/res/layout/relative_layout_ltr_2.xml b/tests/BiDiTests/res/layout/relative_layout_ltr_2.xml
deleted file mode 100644
index a13ef8b..0000000
--- a/tests/BiDiTests/res/layout/relative_layout_ltr_2.xml
+++ /dev/null
@@ -1,155 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/relative_layout_ltr"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layoutDirection="ltr">
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:background="#FF000000"
-            android:padding="10px">
-
-        <TextView android:id="@+id/label_1"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:text="Type here:" />
-
-        <EditText android:id="@+id/entry_1"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/label_1" />
-
-        <Button android:id="@+id/ok_1"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_1"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK" />
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_1"
-                android:layout_alignTop="@id/ok_1"
-                android:text="Cancel" />
-
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:background="#FF000000"
-            android:padding="10px"
-            android:layoutDirection="ltr">
-
-        <TextView android:id="@+id/label_2"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:text="Type here:" />
-
-        <EditText android:id="@+id/entry_2"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/label_2" />
-
-        <Button android:id="@+id/ok_2"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_2"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK" />
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_2"
-                android:layout_alignTop="@id/ok_2"
-                android:text="Cancel" />
-
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:background="#FF000000"
-            android:padding="10px"
-            android:layoutDirection="inherit">
-
-        <TextView android:id="@+id/label_3"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:text="Type here:" />
-
-        <EditText android:id="@+id/entry_3"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/label_3" />
-
-        <Button android:id="@+id/ok_3"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_3"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK" />
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_3"
-                android:layout_alignTop="@id/ok_3"
-                android:text="Cancel" />
-
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:background="#FF000000"
-            android:padding="10px"
-            android:layoutDirection="rtl">
-
-        <TextView android:id="@+id/label_4"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:text="Type here:" />
-
-        <EditText android:id="@+id/entry_4"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/label_4" />
-
-        <Button android:id="@+id/ok_4"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_4"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK" />
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_4"
-                android:layout_alignTop="@id/ok_4"
-                android:text="Cancel" />
-
-    </RelativeLayout>
-
-</LinearLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/relative_layout_rtl.xml b/tests/BiDiTests/res/layout/relative_layout_rtl.xml
index 5808924..57b2ad0 100644
--- a/tests/BiDiTests/res/layout/relative_layout_rtl.xml
+++ b/tests/BiDiTests/res/layout/relative_layout_rtl.xml
@@ -15,74 +15,74 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/frame_layout_rtl"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layoutDirection="rtl"
-    android:background="#FF000000">
+             android:id="@+id/frame_layout_rtl"
+             android:layout_width="match_parent"
+             android:layout_height="match_parent"
+             android:layoutDirection="rtl"
+             android:background="#FF000000">
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="right|center_vertical"
             android:background="#FFFF0000">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="left|center_vertical"
             android:background="#FF00FF00">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="top|center_horizontal"
             android:background="#FF0000FF">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="bottom|center_horizontal"
             android:background="#FF00FFFF">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="top|start"
             android:background="#FFFFFFFF">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="top|end"
             android:background="#FFFFFF00">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="bottom|start"
             android:background="#FFFFFFFF">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="bottom|end"
             android:background="#FFFFFF00">
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <RelativeLayout
+    <RelativeLayout
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:layout_gravity="center_horizontal|center_vertical"
             android:background="#FF888888">
-        </RelativeLayout>
+    </RelativeLayout>
 
 </FrameLayout>
 
diff --git a/tests/BiDiTests/res/layout/relative_layout_rtl_2.xml b/tests/BiDiTests/res/layout/relative_layout_rtl_2.xml
deleted file mode 100644
index 1a6b3d5..0000000
--- a/tests/BiDiTests/res/layout/relative_layout_rtl_2.xml
+++ /dev/null
@@ -1,155 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/relative_layout_ltr"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layoutDirection="rtl">
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:background="#FF000000"
-            android:padding="10px">
-
-        <TextView android:id="@+id/label_1"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:text="Type here:" />
-
-        <EditText android:id="@+id/entry_1"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/label_1" />
-
-        <Button android:id="@+id/ok_1"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_1"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK" />
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_1"
-                android:layout_alignTop="@id/ok_1"
-                android:text="Cancel" />
-
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:background="#FF000000"
-            android:padding="10px"
-            android:layoutDirection="ltr">
-
-        <TextView android:id="@+id/label_2"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:text="Type here:" />
-
-        <EditText android:id="@+id/entry_2"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/label_2" />
-
-        <Button android:id="@+id/ok_2"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_2"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK" />
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_2"
-                android:layout_alignTop="@id/ok_2"
-                android:text="Cancel" />
-
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:background="#FF000000"
-            android:padding="10px"
-            android:layoutDirection="inherit">
-
-        <TextView android:id="@+id/label_3"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:text="Type here:" />
-
-        <EditText android:id="@+id/entry_3"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/label_3" />
-
-        <Button android:id="@+id/ok_3"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_3"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK" />
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_3"
-                android:layout_alignTop="@id/ok_3"
-                android:text="Cancel" />
-
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:background="#FF000000"
-            android:padding="10px"
-            android:layoutDirection="rtl">
-
-        <TextView android:id="@+id/label_4"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:text="Type here:" />
-
-        <EditText android:id="@+id/entry_4"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/label_4" />
-
-        <Button android:id="@+id/ok_4"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_4"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK" />
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_4"
-                android:layout_alignTop="@id/ok_4"
-                android:text="Cancel" />
-
-    </RelativeLayout>
-
-</LinearLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/table_layout_locale.xml b/tests/BiDiTests/res/layout/table_layout_locale.xml
new file mode 100644
index 0000000..847eb07
--- /dev/null
+++ b/tests/BiDiTests/res/layout/table_layout_locale.xml
@@ -0,0 +1,258 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:id="@+id/linear_layout_ltr"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:layoutDirection="locale">
+
+    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2">
+
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_right_text"
+                    android:textSize="24dip"
+                    android:gravity="right"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_after_text"
+                    android:textSize="24dip"
+                    android:gravity="after"
+                    />
+        </TableRow>
+
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_left_text"
+                    android:textSize="24dip"
+                    android:gravity="left"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_before_text"
+                    android:textSize="24dip"
+                    android:gravity="before"
+                    />
+        </TableRow>
+    </TableLayout>
+
+    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2"
+                 android:layoutDirection="inherit">
+
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_right_text"
+                    android:textSize="24dip"
+                    android:gravity="right"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_after_text"
+                    android:textSize="24dip"
+                    android:gravity="after"
+                    />
+        </TableRow>
+
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_left_text"
+                    android:textSize="24dip"
+                    android:gravity="left"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_before_text"
+                    android:textSize="24dip"
+                    android:gravity="before"
+                    />
+        </TableRow>
+    </TableLayout>
+
+    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2"
+                 android:layoutDirection="ltr">
+
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_right_text"
+                    android:textSize="24dip"
+                    android:gravity="right"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_after_text"
+                    android:textSize="24dip"
+                    android:gravity="after"
+                    />
+        </TableRow>
+
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_left_text"
+                    android:textSize="24dip"
+                    android:gravity="left"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_before_text"
+                    android:textSize="24dip"
+                    android:gravity="before"
+                    />
+        </TableRow>
+    </TableLayout>
+
+    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2"
+                 android:layoutDirection="rtl">
+
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_right_text"
+                    android:textSize="24dip"
+                    android:gravity="right"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_after_text"
+                    android:textSize="24dip"
+                    android:gravity="after"
+                    />
+        </TableRow>
+
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_left_text"
+                    android:textSize="24dip"
+                    android:gravity="left"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_before_text"
+                    android:textSize="24dip"
+                    android:gravity="before"
+                    />
+        </TableRow>
+    </TableLayout>
+
+    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2"
+                 android:layoutDirection="locale">
+
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_right_text"
+                    android:textSize="24dip"
+                    android:gravity="right"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_after_text"
+                    android:textSize="24dip"
+                    android:gravity="after"
+                    />
+        </TableRow>
+
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_left_text"
+                    android:textSize="24dip"
+                    android:gravity="left"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_before_text"
+                    android:textSize="24dip"
+                    android:gravity="before"
+                    />
+        </TableRow>
+    </TableLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/table_layout_ltr.xml b/tests/BiDiTests/res/layout/table_layout_ltr.xml
index 8e1891e..49d1d0d 100644
--- a/tests/BiDiTests/res/layout/table_layout_ltr.xml
+++ b/tests/BiDiTests/res/layout/table_layout_ltr.xml
@@ -15,35 +15,35 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/linear_layout_ltr"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layoutDirection="ltr">
+              android:id="@+id/linear_layout_ltr"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:layoutDirection="ltr">
 
     <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:stretchColumns="1,2">
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2">
 
         <TableRow>
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button1_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_right_text"
                     android:textSize="24dip"
                     android:gravity="right"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_after_text"
                     android:textSize="24dip"
                     android:gravity="after"
-             />
+                    />
         </TableRow>
 
         <TableRow>
@@ -51,47 +51,46 @@
                     android:layout_width="wrap_content"
                     android:text="@string/button2_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_left_text"
                     android:textSize="24dip"
                     android:gravity="left"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_before_text"
                     android:textSize="24dip"
                     android:gravity="before"
-             />
+                    />
         </TableRow>
-
     </TableLayout>
 
     <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:stretchColumns="1,2"
-        android:layoutDirection="inherit">
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2"
+                 android:layoutDirection="inherit">
 
         <TableRow>
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button1_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_right_text"
                     android:textSize="24dip"
                     android:gravity="right"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_after_text"
                     android:textSize="24dip"
                     android:gravity="after"
-             />
+                    />
         </TableRow>
 
         <TableRow>
@@ -99,47 +98,46 @@
                     android:layout_width="wrap_content"
                     android:text="@string/button2_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_left_text"
                     android:textSize="24dip"
                     android:gravity="left"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_before_text"
                     android:textSize="24dip"
                     android:gravity="before"
-             />
+                    />
         </TableRow>
-
     </TableLayout>
 
     <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:stretchColumns="1,2"
-        android:layoutDirection="ltr">
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2"
+                 android:layoutDirection="ltr">
 
         <TableRow>
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button1_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_right_text"
                     android:textSize="24dip"
                     android:gravity="right"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_after_text"
                     android:textSize="24dip"
                     android:gravity="after"
-             />
+                    />
         </TableRow>
 
         <TableRow>
@@ -147,47 +145,46 @@
                     android:layout_width="wrap_content"
                     android:text="@string/button2_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_left_text"
                     android:textSize="24dip"
                     android:gravity="left"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_before_text"
                     android:textSize="24dip"
                     android:gravity="before"
-             />
+                    />
         </TableRow>
-
     </TableLayout>
 
     <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:stretchColumns="1,2"
-        android:layoutDirection="rtl">
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2"
+                 android:layoutDirection="rtl">
 
         <TableRow>
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button1_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_right_text"
                     android:textSize="24dip"
                     android:gravity="right"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_after_text"
                     android:textSize="24dip"
                     android:gravity="after"
-             />
+                    />
         </TableRow>
 
         <TableRow>
@@ -195,21 +192,67 @@
                     android:layout_width="wrap_content"
                     android:text="@string/button2_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_left_text"
                     android:textSize="24dip"
                     android:gravity="left"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_before_text"
                     android:textSize="24dip"
                     android:gravity="before"
-             />
+                    />
+        </TableRow>
+    </TableLayout>
+
+    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2"
+                 android:layoutDirection="locale">
+
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_right_text"
+                    android:textSize="24dip"
+                    android:gravity="right"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_after_text"
+                    android:textSize="24dip"
+                    android:gravity="after"
+                    />
         </TableRow>
 
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_left_text"
+                    android:textSize="24dip"
+                    android:gravity="left"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_before_text"
+                    android:textSize="24dip"
+                    android:gravity="before"
+                    />
+        </TableRow>
     </TableLayout>
 
 </LinearLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/table_layout_rtl.xml b/tests/BiDiTests/res/layout/table_layout_rtl.xml
index bd664e4..a665e45 100644
--- a/tests/BiDiTests/res/layout/table_layout_rtl.xml
+++ b/tests/BiDiTests/res/layout/table_layout_rtl.xml
@@ -15,35 +15,35 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/linear_layout_ltr"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layoutDirection="rtl">
+              android:id="@+id/linear_layout_ltr"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:layoutDirection="rtl">
 
     <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:stretchColumns="1,2">
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2">
 
         <TableRow>
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button1_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_right_text"
                     android:textSize="24dip"
                     android:gravity="right"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_after_text"
                     android:textSize="24dip"
                     android:gravity="after"
-             />
+                    />
         </TableRow>
 
         <TableRow>
@@ -51,47 +51,46 @@
                     android:layout_width="wrap_content"
                     android:text="@string/button2_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_left_text"
                     android:textSize="24dip"
                     android:gravity="left"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_before_text"
                     android:textSize="24dip"
                     android:gravity="before"
-             />
+                    />
         </TableRow>
-
     </TableLayout>
 
     <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:stretchColumns="1,2"
-        android:layoutDirection="inherit">
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2"
+                 android:layoutDirection="inherit">
 
         <TableRow>
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button1_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_right_text"
                     android:textSize="24dip"
                     android:gravity="right"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_after_text"
                     android:textSize="24dip"
                     android:gravity="after"
-             />
+                    />
         </TableRow>
 
         <TableRow>
@@ -99,47 +98,46 @@
                     android:layout_width="wrap_content"
                     android:text="@string/button2_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_left_text"
                     android:textSize="24dip"
                     android:gravity="left"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_before_text"
                     android:textSize="24dip"
                     android:gravity="before"
-             />
+                    />
         </TableRow>
-
     </TableLayout>
 
     <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:stretchColumns="1,2"
-        android:layoutDirection="ltr">
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2"
+                 android:layoutDirection="ltr">
 
         <TableRow>
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button1_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_right_text"
                     android:textSize="24dip"
                     android:gravity="right"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_after_text"
                     android:textSize="24dip"
                     android:gravity="after"
-             />
+                    />
         </TableRow>
 
         <TableRow>
@@ -147,47 +145,46 @@
                     android:layout_width="wrap_content"
                     android:text="@string/button2_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_left_text"
                     android:textSize="24dip"
                     android:gravity="left"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_before_text"
                     android:textSize="24dip"
                     android:gravity="before"
-             />
+                    />
         </TableRow>
-
     </TableLayout>
 
     <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:stretchColumns="1,2"
-        android:layoutDirection="rtl">
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2"
+                 android:layoutDirection="rtl">
 
         <TableRow>
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button1_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_right_text"
                     android:textSize="24dip"
                     android:gravity="right"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_after_text"
                     android:textSize="24dip"
                     android:gravity="after"
-             />
+                    />
         </TableRow>
 
         <TableRow>
@@ -195,21 +192,67 @@
                     android:layout_width="wrap_content"
                     android:text="@string/button2_text"
                     android:textSize="24dip"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_left_text"
                     android:textSize="24dip"
                     android:gravity="left"
-             />
+                    />
             <Button android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:text="@string/button_before_text"
                     android:textSize="24dip"
                     android:gravity="before"
-             />
+                    />
+        </TableRow>
+    </TableLayout>
+
+    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:stretchColumns="1,2"
+                 android:layoutDirection="locale">
+
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_right_text"
+                    android:textSize="24dip"
+                    android:gravity="right"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_after_text"
+                    android:textSize="24dip"
+                    android:gravity="after"
+                    />
         </TableRow>
 
+        <TableRow>
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_left_text"
+                    android:textSize="24dip"
+                    android:gravity="left"
+                    />
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_before_text"
+                    android:textSize="24dip"
+                    android:gravity="before"
+                    />
+        </TableRow>
     </TableLayout>
 
 </LinearLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
index 2662683..1ffe7ee 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
@@ -57,6 +57,11 @@
             setContent(intent);
         tabHost.addTab(spec);
 
+        intent = new Intent().setClass(this, BiDiTestLinearLayoutLocaleActivity.class);
+        spec = tabHost.newTabSpec("linear-layout-locale").setIndicator("Linear LOC").
+            setContent(intent);
+        tabHost.addTab(spec);
+
         intent = new Intent().setClass(this, BiDiTestFrameLayoutLtrActivity.class);
         spec = tabHost.newTabSpec("frame-layout-ltr").setIndicator("Frame LTR").
             setContent(intent);
@@ -67,6 +72,11 @@
             setContent(intent);
         tabHost.addTab(spec);
 
+        intent = new Intent().setClass(this, BiDiTestFrameLayoutLocaleActivity.class);
+        spec = tabHost.newTabSpec("frame-layout-locale").setIndicator("Frame LOC").
+            setContent(intent);
+        tabHost.addTab(spec);
+
         intent = new Intent().setClass(this, BiDiTestRelativeLayoutLtrActivity.class);
         spec = tabHost.newTabSpec("relative-layout-ltr").setIndicator("Relative LTR").
             setContent(intent);
@@ -87,6 +97,11 @@
             setContent(intent);
         tabHost.addTab(spec);
 
+        intent = new Intent().setClass(this, BiDiTestRelativeLayoutLocaleActivity2.class);
+        spec = tabHost.newTabSpec("relative-layout-locale-2").setIndicator("Relative2 LOC").
+            setContent(intent);
+        tabHost.addTab(spec);
+
         intent = new Intent().setClass(this, BiDiTestTableLayoutLtrActivity.class);
         spec = tabHost.newTabSpec("table-layout-ltr").setIndicator("Table LTR").
             setContent(intent);
@@ -97,6 +112,11 @@
             setContent(intent);
         tabHost.addTab(spec);
 
+        intent = new Intent().setClass(this, BiDiTestTableLayoutLocaleActivity.class);
+        spec = tabHost.newTabSpec("table-layout-locale").setIndicator("Table LOC").
+            setContent(intent);
+        tabHost.addTab(spec);
+
         tabHost.setCurrentTab(0);
     }
 }
\ No newline at end of file
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLocaleActivity.java
new file mode 100644
index 0000000..457c52a
--- /dev/null
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLocaleActivity.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.android.bidi;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class BiDiTestFrameLayoutLocaleActivity extends Activity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.frame_layout_locale);
+    }
+}
+
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
new file mode 100644
index 0000000..8694dd1
--- /dev/null
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.android.bidi;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.linear_layout_locale);
+    }
+}
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLocaleActivity2.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLocaleActivity2.java
new file mode 100644
index 0000000..8a52b38
--- /dev/null
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLocaleActivity2.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.android.bidi;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class BiDiTestRelativeLayoutLocaleActivity2 extends Activity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.relative_layout_2_locale);
+    }
+}
+
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java
index 476375c..65a5ed0 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java
@@ -25,7 +25,7 @@
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        setContentView(R.layout.relative_layout_ltr_2);
+        setContentView(R.layout.relative_layout_2_ltr);
     }
 }
 
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java
index db2af7f..dad5491 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java
@@ -25,7 +25,7 @@
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        setContentView(R.layout.relative_layout_rtl_2);
+        setContentView(R.layout.relative_layout_2_rtl);
     }
 }
 
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLocaleActivity.java
new file mode 100644
index 0000000..9222aa2
--- /dev/null
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLocaleActivity.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.android.bidi;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class BiDiTestTableLayoutLocaleActivity extends Activity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.table_layout_locale);
+    }
+}
+