Merge "Match legacy theme colors with gingerbread"
diff --git a/api/current.txt b/api/current.txt
index 51c9348..d490e29 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -696,8 +696,10 @@
     field public static final int packageNames = 16843651; // 0x1010383
     field public static final int padding = 16842965; // 0x10100d5
     field public static final int paddingBottom = 16842969; // 0x10100d9
+    field public static final int paddingEnd = 16843673; // 0x1010399
     field public static final int paddingLeft = 16842966; // 0x10100d6
     field public static final int paddingRight = 16842968; // 0x10100d8
+    field public static final int paddingStart = 16843672; // 0x1010398
     field public static final int paddingTop = 16842967; // 0x10100d7
     field public static final int panelBackground = 16842846; // 0x101005e
     field public static final int panelColorBackground = 16842849; // 0x1010061
@@ -16663,10 +16665,25 @@
     method public static android.renderscript.Element F32_3(android.renderscript.RenderScript);
     method public static android.renderscript.Element F32_4(android.renderscript.RenderScript);
     method public static android.renderscript.Element F64(android.renderscript.RenderScript);
+    method public static android.renderscript.Element F64_2(android.renderscript.RenderScript);
+    method public static android.renderscript.Element F64_3(android.renderscript.RenderScript);
+    method public static android.renderscript.Element F64_4(android.renderscript.RenderScript);
     method public static android.renderscript.Element I16(android.renderscript.RenderScript);
+    method public static android.renderscript.Element I16_2(android.renderscript.RenderScript);
+    method public static android.renderscript.Element I16_3(android.renderscript.RenderScript);
+    method public static android.renderscript.Element I16_4(android.renderscript.RenderScript);
     method public static android.renderscript.Element I32(android.renderscript.RenderScript);
+    method public static android.renderscript.Element I32_2(android.renderscript.RenderScript);
+    method public static android.renderscript.Element I32_3(android.renderscript.RenderScript);
+    method public static android.renderscript.Element I32_4(android.renderscript.RenderScript);
     method public static android.renderscript.Element I64(android.renderscript.RenderScript);
+    method public static android.renderscript.Element I64_2(android.renderscript.RenderScript);
+    method public static android.renderscript.Element I64_3(android.renderscript.RenderScript);
+    method public static android.renderscript.Element I64_4(android.renderscript.RenderScript);
     method public static android.renderscript.Element I8(android.renderscript.RenderScript);
+    method public static android.renderscript.Element I8_2(android.renderscript.RenderScript);
+    method public static android.renderscript.Element I8_3(android.renderscript.RenderScript);
+    method public static android.renderscript.Element I8_4(android.renderscript.RenderScript);
     method public static android.renderscript.Element MATRIX4X4(android.renderscript.RenderScript);
     method public static android.renderscript.Element MATRIX_2X2(android.renderscript.RenderScript);
     method public static android.renderscript.Element MATRIX_3X3(android.renderscript.RenderScript);
@@ -16685,9 +16702,20 @@
     method public static android.renderscript.Element SCRIPT(android.renderscript.RenderScript);
     method public static android.renderscript.Element TYPE(android.renderscript.RenderScript);
     method public static android.renderscript.Element U16(android.renderscript.RenderScript);
+    method public static android.renderscript.Element U16_2(android.renderscript.RenderScript);
+    method public static android.renderscript.Element U16_3(android.renderscript.RenderScript);
+    method public static android.renderscript.Element U16_4(android.renderscript.RenderScript);
     method public static android.renderscript.Element U32(android.renderscript.RenderScript);
+    method public static android.renderscript.Element U32_2(android.renderscript.RenderScript);
+    method public static android.renderscript.Element U32_3(android.renderscript.RenderScript);
+    method public static android.renderscript.Element U32_4(android.renderscript.RenderScript);
     method public static android.renderscript.Element U64(android.renderscript.RenderScript);
+    method public static android.renderscript.Element U64_2(android.renderscript.RenderScript);
+    method public static android.renderscript.Element U64_3(android.renderscript.RenderScript);
+    method public static android.renderscript.Element U64_4(android.renderscript.RenderScript);
     method public static android.renderscript.Element U8(android.renderscript.RenderScript);
+    method public static android.renderscript.Element U8_2(android.renderscript.RenderScript);
+    method public static android.renderscript.Element U8_3(android.renderscript.RenderScript);
     method public static android.renderscript.Element U8_4(android.renderscript.RenderScript);
     method public static android.renderscript.Element createPixel(android.renderscript.RenderScript, android.renderscript.Element.DataType, android.renderscript.Element.DataKind);
     method public static android.renderscript.Element createVector(android.renderscript.RenderScript, android.renderscript.Element.DataType, int);
diff --git a/core/java/android/nfc/NdefRecord.java b/core/java/android/nfc/NdefRecord.java
index 3fd26dd..5ade9eb 100644
--- a/core/java/android/nfc/NdefRecord.java
+++ b/core/java/android/nfc/NdefRecord.java
@@ -332,6 +332,28 @@
         return Uri.parse(new String(fullUri, Charsets.UTF_8));
     }
 
+    /**
+     * Creates an NDEF record of well known type URI.
+     * TODO: Make a public API
+     * @hide
+     */
+    public static NdefRecord createUri(Uri uri) {
+        String uriString = uri.toString();
+        byte prefix = 0x0;
+        for (int i = 1; i < URI_PREFIX_MAP.length; i++) {
+            if (uriString.startsWith(URI_PREFIX_MAP[i])) {
+                prefix = (byte) i;
+                uriString = uriString.substring(URI_PREFIX_MAP[i].length());
+                break;
+            }
+        }
+        byte[] uriBytes = uriString.getBytes(Charsets.UTF_8);
+        byte[] recordBytes = new byte[uriBytes.length + 1];
+        recordBytes[0] = prefix;
+        System.arraycopy(uriBytes, 0, recordBytes, 1, uriBytes.length);
+        return new NdefRecord(TNF_WELL_KNOWN, RTD_URI, new byte[0], recordBytes);
+    }
+
     private static byte[] concat(byte[]... arrays) {
         int length = 0;
         for (byte[] array : arrays) {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 888f0c0..46df88b 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -345,7 +345,7 @@
  * 2 pixels to the right of the left edge. Padding can be set using the
  * {@link #setPadding(int, int, int, int)} method and queried by calling
  * {@link #getPaddingLeft()}, {@link #getPaddingTop()},
- * {@link #getPaddingRight()} and {@link #getPaddingBottom()}.
+ * {@link #getPaddingRight()}, {@link #getPaddingBottom()}.
  * </p>
  *
  * <p>
@@ -607,6 +607,8 @@
  * @attr ref android.R.styleable#View_paddingLeft
  * @attr ref android.R.styleable#View_paddingRight
  * @attr ref android.R.styleable#View_paddingTop
+ * @attr ref android.R.styleable#View_paddingStart
+ * @attr ref android.R.styleable#View_paddingEnd
  * @attr ref android.R.styleable#View_saveEnabled
  * @attr ref android.R.styleable#View_rotation
  * @attr ref android.R.styleable#View_rotationX
@@ -1734,11 +1736,20 @@
     static final int DRAG_HOVERED                 = 0x00000002;
 
     /**
-     * Indicates whether the view is drawn in right-to-left direction.
+     * Indicates whether the view layout direction has been resolved and drawn to the
+     * right-to-left direction.
      *
      * @hide
      */
-    static final int RESOLVED_LAYOUT_RTL          = 0x00000004;
+    static final int LAYOUT_DIRECTION_RESOLVED_RTL = 0x00000004;
+
+    /**
+     * Indicates whether the view layout direction has been resolved.
+     *
+     * @hide
+     */
+    static final int LAYOUT_DIRECTION_RESOLVED = 0x00000008;
+
 
     /* End of masks for mPrivateFlags2 */
 
@@ -2173,6 +2184,33 @@
     int mUserPaddingLeft;
 
     /**
+     * Cache the paddingTop set by the user to append to the scrollbar's size.
+     */
+    @ViewDebug.ExportedProperty(category = "padding")
+    int mUserPaddingTop;
+
+    /**
+     * Cache if the user padding is relative.
+     *
+     */
+    @ViewDebug.ExportedProperty(category = "padding")
+    boolean mUserPaddingRelative;
+
+    /**
+     * Cache the paddingStart set by the user to append to the scrollbar's size.
+     *
+     */
+    @ViewDebug.ExportedProperty(category = "padding")
+    int mUserPaddingStart;
+
+    /**
+     * Cache the paddingEnd set by the user to append to the scrollbar's size.
+     *
+     */
+    @ViewDebug.ExportedProperty(category = "padding")
+    int mUserPaddingEnd;
+
+    /**
      * @hide
      */
     int mOldWidthMeasureSpec = Integer.MIN_VALUE;
@@ -2523,6 +2561,8 @@
         int topPadding = -1;
         int rightPadding = -1;
         int bottomPadding = -1;
+        int startPadding = -1;
+        int endPadding = -1;
 
         int padding = -1;
 
@@ -2568,6 +2608,12 @@
                 case com.android.internal.R.styleable.View_paddingBottom:
                     bottomPadding = a.getDimensionPixelSize(attr, -1);
                     break;
+                case com.android.internal.R.styleable.View_paddingStart:
+                    startPadding = a.getDimensionPixelSize(attr, -1);
+                    break;
+                case com.android.internal.R.styleable.View_paddingEnd:
+                    endPadding = a.getDimensionPixelSize(attr, -1);
+                    break;
                 case com.android.internal.R.styleable.View_scrollX:
                     x = a.getDimensionPixelOffset(attr, 0);
                     break;
@@ -2822,11 +2868,15 @@
             setBackgroundDrawable(background);
         }
 
+        mUserPaddingRelative = (startPadding >= 0 || endPadding >= 0);
+
         if (padding >= 0) {
             leftPadding = padding;
             topPadding = padding;
             rightPadding = padding;
             bottomPadding = padding;
+            startPadding = padding;
+            endPadding = padding;
         }
 
         // If the user specified the padding (either with android:padding or
@@ -2838,6 +2888,15 @@
                 rightPadding >= 0 ? rightPadding : mPaddingRight,
                 bottomPadding >= 0 ? bottomPadding : mPaddingBottom);
 
+        // Cache user padding as we cannot fully resolve padding here (we dont have yet the resolved
+        // layout direction). Those cached values will be used later during padding resolution.
+        mUserPaddingLeft = leftPadding;
+        mUserPaddingRight = rightPadding;
+        mUserPaddingStart = startPadding;
+        mUserPaddingEnd = endPadding;
+        mUserPaddingTop = topPadding;
+        mUserPaddingBottom = bottomPadding;
+
         if (viewFlagMasks != 0) {
             setFlags(viewFlagValues, viewFlagMasks);
         }
@@ -3059,7 +3118,7 @@
         }
 
         // Re-apply user/background padding so that scrollbar(s) get added
-        recomputePadding();
+        resolvePadding();
     }
 
     /**
@@ -3084,7 +3143,7 @@
         if (mVerticalScrollbarPosition != position) {
             mVerticalScrollbarPosition = position;
             computeOpaqueFlags();
-            recomputePadding();
+            resolvePadding();
         }
     }
 
@@ -4315,8 +4374,8 @@
         @ViewDebug.IntToString(from = LAYOUT_DIRECTION_RTL,     to = "RESOLVED_DIRECTION_RTL")
     })
     public int getResolvedLayoutDirection() {
-        resolveLayoutDirection();
-        return ((mPrivateFlags2 & RESOLVED_LAYOUT_RTL) == RESOLVED_LAYOUT_RTL) ?
+        resolveLayoutDirectionIfNeeded();
+        return ((mPrivateFlags2 & LAYOUT_DIRECTION_RESOLVED_RTL) == LAYOUT_DIRECTION_RESOLVED_RTL) ?
                 LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR;
     }
 
@@ -8265,7 +8324,7 @@
         if (isHorizontalScrollBarEnabled() != horizontalScrollBarEnabled) {
             mViewFlags ^= SCROLLBARS_HORIZONTAL;
             computeOpaqueFlags();
-            recomputePadding();
+            resolvePadding();
         }
     }
 
@@ -8295,7 +8354,7 @@
         if (isVerticalScrollBarEnabled() != verticalScrollBarEnabled) {
             mViewFlags ^= SCROLLBARS_VERTICAL;
             computeOpaqueFlags();
-            recomputePadding();
+            resolvePadding();
         }
     }
 
@@ -8354,7 +8413,7 @@
         if (style != (mViewFlags & SCROLLBARS_STYLE_MASK)) {
             mViewFlags = (mViewFlags & ~SCROLLBARS_STYLE_MASK) | (style & SCROLLBARS_STYLE_MASK);
             computeOpaqueFlags();
-            recomputePadding();
+            resolvePadding();
         }
     }
 
@@ -8739,7 +8798,9 @@
             mPrivateFlags &= ~AWAKEN_SCROLL_BARS_ON_ATTACH;
         }
         jumpDrawablesToCurrentState();
-        resolveLayoutDirection();
+        resetLayoutDirectionResolution();
+        resolveLayoutDirectionIfNeeded();
+        resolvePadding();
         if (isFocused()) {
             InputMethodManager imm = InputMethodManager.peekInstance();
             imm.focusIn(this);
@@ -8747,31 +8808,91 @@
     }
 
     /**
-     * Resolving the layout direction. LTR is set initially.
-     * We are supposing here that the parent directionality will be resolved before its children.
+     * Resolve and cache the layout direction. LTR is set initially. This is implicitly supposing
+     * that the parent directionality can and will be resolved before its children.
      */
-    private void resolveLayoutDirection() {
-        mPrivateFlags2 &= ~RESOLVED_LAYOUT_RTL;
+    private void resolveLayoutDirectionIfNeeded() {
+        // Do not resolve if it is not needed
+        if ((mPrivateFlags2 & LAYOUT_DIRECTION_RESOLVED) == LAYOUT_DIRECTION_RESOLVED) return;
+
+        // Clear any previous layout direction resolution
+        mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED_RTL;
+
+        // Set resolved depending on layout direction
         switch (getLayoutDirection()) {
             case LAYOUT_DIRECTION_INHERIT:
                 // If this is root view, no need to look at parent's layout dir.
                 if (mParent != null &&
                         mParent instanceof ViewGroup &&
                         ((ViewGroup) mParent).getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) {
-                    mPrivateFlags2 |= RESOLVED_LAYOUT_RTL;
+                    mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED_RTL;
                 }
                 break;
             case LAYOUT_DIRECTION_RTL:
-                mPrivateFlags2 |= RESOLVED_LAYOUT_RTL;
+                mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED_RTL;
                 break;
             case LAYOUT_DIRECTION_LOCALE:
                 if(isLayoutDirectionRtl(Locale.getDefault())) {
-                    mPrivateFlags2 |= RESOLVED_LAYOUT_RTL;
+                    mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED_RTL;
                 }
                 break;
             default:
                 // Nothing to do, LTR by default
         }
+
+        // Set to resolved
+        mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED;
+    }
+
+    private void resolvePadding() {
+        // If the user specified the absolute padding (either with android:padding or
+        // android:paddingLeft/Top/Right/Bottom), use this padding, otherwise
+        // use the default padding or the padding from the background drawable
+        // (stored at this point in mPadding*)
+        switch (getResolvedLayoutDirection()) {
+            case LAYOUT_DIRECTION_RTL:
+                // Start user padding override Right user padding. Otherwise, if Right user
+                // padding is not defined, use the default Right padding. If Right user padding
+                // is defined, just use it.
+                if (mUserPaddingStart >= 0) {
+                    mUserPaddingRight = mUserPaddingStart;
+                } else if (mUserPaddingRight < 0) {
+                    mUserPaddingRight = mPaddingRight;
+                }
+                if (mUserPaddingEnd >= 0) {
+                    mUserPaddingLeft = mUserPaddingEnd;
+                } else if (mUserPaddingLeft < 0) {
+                    mUserPaddingLeft = mPaddingLeft;
+                }
+                break;
+            case LAYOUT_DIRECTION_LTR:
+            default:
+                // Start user padding override Left user padding. Otherwise, if Left user
+                // padding is not defined, use the default left padding. If Left user padding
+                // is defined, just use it.
+                if (mUserPaddingStart >= 0) {
+                    mUserPaddingLeft = mUserPaddingStart;
+                } else if (mUserPaddingLeft < 0) {
+                    mUserPaddingLeft = mPaddingLeft;
+                }
+                if (mUserPaddingEnd >= 0) {
+                    mUserPaddingRight = mUserPaddingEnd;
+                } else if (mUserPaddingRight < 0) {
+                    mUserPaddingRight = mPaddingRight;
+                }
+        }
+
+        mPaddingTop = (mUserPaddingTop >= 0) ? mUserPaddingTop : mPaddingTop;
+        mUserPaddingBottom = (mUserPaddingBottom >= 0) ? mUserPaddingBottom : mPaddingBottom;
+
+        recomputePadding();
+    }
+
+    /**
+     * Reset the resolved layout direction by clearing the corresponding flag
+     */
+    private void resetLayoutDirectionResolution() {
+        mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED;
     }
 
     /**
@@ -10745,7 +10866,14 @@
                 sThreadLocal.set(padding);
             }
             if (d.getPadding(padding)) {
-                setPadding(padding.left, padding.top, padding.right, padding.bottom);
+                switch (d.getResolvedLayoutDirectionSelf()) {
+                    case LAYOUT_DIRECTION_RTL:
+                        setPadding(padding.right, padding.top, padding.left, padding.bottom);
+                        break;
+                    case LAYOUT_DIRECTION_LTR:
+                    default:
+                        setPadding(padding.left, padding.top, padding.right, padding.bottom);
+                }
             }
 
             // Compare the minimum sizes of the old Drawable and the new.  If there isn't an old or
@@ -10831,6 +10959,8 @@
     public void setPadding(int left, int top, int right, int bottom) {
         boolean changed = false;
 
+        mUserPaddingRelative = false;
+
         mUserPaddingLeft = left;
         mUserPaddingRight = right;
         mUserPaddingBottom = bottom;
@@ -10840,11 +10970,16 @@
         // Common case is there are no scroll bars.
         if ((viewFlags & (SCROLLBARS_VERTICAL|SCROLLBARS_HORIZONTAL)) != 0) {
             if ((viewFlags & SCROLLBARS_VERTICAL) != 0) {
-                // TODO Determine what to do with SCROLLBAR_POSITION_DEFAULT based on RTL settings.
                 final int offset = (viewFlags & SCROLLBARS_INSET_MASK) == 0
                         ? 0 : getVerticalScrollbarWidth();
                 switch (mVerticalScrollbarPosition) {
                     case SCROLLBAR_POSITION_DEFAULT:
+                        if (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) {
+                            left += offset;
+                        } else {
+                            right += offset;
+                        }
+                        break;
                     case SCROLLBAR_POSITION_RIGHT:
                         right += offset;
                         break;
@@ -10882,6 +11017,37 @@
     }
 
     /**
+     * Sets the relative padding. The view may add on the space required to display
+     * the scrollbars, depending on the style and visibility of the scrollbars.
+     * So the values returned from {@link #getPaddingStart}, {@link #getPaddingTop},
+     * {@link #getPaddingEnd} and {@link #getPaddingBottom} may be different
+     * from the values set in this call.
+     *
+     * @attr ref android.R.styleable#View_padding
+     * @attr ref android.R.styleable#View_paddingBottom
+     * @attr ref android.R.styleable#View_paddingStart
+     * @attr ref android.R.styleable#View_paddingEnd
+     * @attr ref android.R.styleable#View_paddingTop
+     * @param start the start padding in pixels
+     * @param top the top padding in pixels
+     * @param end the end padding in pixels
+     * @param bottom the bottom padding in pixels
+     *
+     * @hide
+     */
+    public void setPaddingRelative(int start, int top, int end, int bottom) {
+        mUserPaddingRelative = true;
+        switch(getResolvedLayoutDirection()) {
+            case LAYOUT_DIRECTION_RTL:
+                setPadding(end, top, start, bottom);
+                break;
+            case LAYOUT_DIRECTION_LTR:
+            default:
+                setPadding(start, top, end, bottom);
+        }
+    }
+
+    /**
      * Returns the top padding of this view.
      *
      * @return the top padding in pixels
@@ -10913,6 +11079,20 @@
     }
 
     /**
+     * Returns the start padding of this view. If there are inset and enabled
+     * scrollbars, this value may include the space required to display the
+     * scrollbars as well.
+     *
+     * @return the start padding in pixels
+     *
+     * @hide
+     */
+    public int getPaddingStart() {
+        return (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) ?
+                mPaddingRight : mPaddingLeft;
+    }
+
+    /**
      * Returns the right padding of this view. If there are inset and enabled
      * scrollbars, this value may include the space required to display the
      * scrollbars as well.
@@ -10924,6 +11104,34 @@
     }
 
     /**
+     * Returns the end padding of this view. If there are inset and enabled
+     * scrollbars, this value may include the space required to display the
+     * scrollbars as well.
+     *
+     * @return the end padding in pixels
+     *
+     * @hide
+     */
+    public int getPaddingEnd() {
+        return (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) ?
+                mPaddingLeft : mPaddingRight;
+    }
+
+    /**
+     * Return if the padding as been set thru relative values
+     * {@link #setPaddingRelative(int, int, int, int)} or thru
+     * @attr ref android.R.styleable#View_paddingStart or
+     * @attr ref android.R.styleable#View_paddingEnd
+     *
+     * @return true if the padding is relative or false if it is not.
+     *
+     * @hide
+     */
+    public boolean isPaddingRelative() {
+        return mUserPaddingRelative;
+    }
+
+    /**
      * Changes the selection state of this view. A view can be selected or not.
      * Note that selection is not the same as focus. Views are typically
      * selected in the context of an AdapterView like ListView or GridView;
diff --git a/core/jni/android/graphics/SurfaceTexture.cpp b/core/jni/android/graphics/SurfaceTexture.cpp
index 3f922f6..0d28cb1 100644
--- a/core/jni/android/graphics/SurfaceTexture.cpp
+++ b/core/jni/android/graphics/SurfaceTexture.cpp
@@ -91,6 +91,8 @@
     virtual void onFrameAvailable();
 
 private:
+    static JNIEnv* getJNIEnv();
+
     jobject mWeakThiz;
     jclass mClazz;
 };
@@ -101,17 +103,37 @@
     mClazz((jclass)env->NewGlobalRef(clazz))
 {}
 
+JNIEnv* JNISurfaceTextureContext::getJNIEnv() {
+    JNIEnv* env;
+    JavaVMAttachArgs args = {JNI_VERSION_1_4, NULL, NULL};
+    JavaVM* vm = AndroidRuntime::getJavaVM();
+    int result = vm->AttachCurrentThread(&env, (void*) &args);
+    if (result != JNI_OK) {
+        LOGE("thread attach failed: %#x", result);
+        return NULL;
+    }
+    return env;
+}
+
 JNISurfaceTextureContext::~JNISurfaceTextureContext()
 {
-    JNIEnv *env = AndroidRuntime::getJNIEnv();
-    env->DeleteGlobalRef(mWeakThiz);
-    env->DeleteGlobalRef(mClazz);
+    JNIEnv* env = getJNIEnv();
+    if (env != NULL) {
+        env->DeleteGlobalRef(mWeakThiz);
+        env->DeleteGlobalRef(mClazz);
+    } else {
+        LOGW("leaking JNI object references");
+    }
 }
 
 void JNISurfaceTextureContext::onFrameAvailable()
 {
-    JNIEnv *env = AndroidRuntime::getJNIEnv();
-    env->CallStaticVoidMethod(mClazz, fields.postEvent, mWeakThiz);
+    JNIEnv *env = getJNIEnv();
+    if (env != NULL) {
+        env->CallStaticVoidMethod(mClazz, fields.postEvent, mWeakThiz);
+    } else {
+        LOGW("onFrameAvailable event will not posted");
+    }
 }
 
 // ----------------------------------------------------------------------------
diff --git a/core/res/res/values-af-rZA/arrays.xml b/core/res/res/values-af-rZA/arrays.xml
new file mode 100644
index 0000000..5bff0f4
--- /dev/null
+++ b/core/res/res/values-af-rZA/arrays.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/colors.xml
+**
+** Copyright 2006, Google Inc.
+**
+** 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.
+*/
+-->
+<resources>
+
+    <!-- Do not translate. -->
+    <integer-array name="maps_starting_lat_lng">
+        <item>-30559482</item>
+        <item>22937506</item>
+    </integer-array>
+    <!-- Do not translate. -->
+    <integer-array name="maps_starting_zoom">
+        <item>4</item>
+    </integer-array>
+
+</resources>
diff --git a/core/res/res/values-am-rET/arrays.xml b/core/res/res/values-am-rET/arrays.xml
new file mode 100644
index 0000000..67e8b08
--- /dev/null
+++ b/core/res/res/values-am-rET/arrays.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/colors.xml
+**
+** Copyright 2006, Google Inc.
+**
+** 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.
+*/
+-->
+<resources>
+
+    <!-- Do not translate. -->
+    <integer-array name="maps_starting_lat_lng">
+        <item>9145000</item>
+        <item>40489673</item>
+    </integer-array>
+    <!-- Do not translate. -->
+    <integer-array name="maps_starting_zoom">
+        <item>4</item>
+    </integer-array>
+
+</resources>
diff --git a/core/res/res/values-fa-rIR/arrays.xml b/core/res/res/values-fa-rIR/arrays.xml
new file mode 100644
index 0000000..de0f368
--- /dev/null
+++ b/core/res/res/values-fa-rIR/arrays.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/colors.xml
+**
+** Copyright 2006, Google Inc.
+**
+** 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.
+*/
+-->
+<resources>
+
+    <!-- Do not translate. -->
+    <integer-array name="maps_starting_lat_lng">
+        <item>32427908</item>
+        <item>53688046</item>
+    </integer-array>
+    <!-- Do not translate. -->
+    <integer-array name="maps_starting_zoom">
+        <item>4</item>
+    </integer-array>
+
+</resources>
diff --git a/core/res/res/values-ms-rMY/arrays.xml b/core/res/res/values-ms-rMY/arrays.xml
new file mode 100644
index 0000000..3a708e6
--- /dev/null
+++ b/core/res/res/values-ms-rMY/arrays.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/colors.xml
+**
+** Copyright 2006, Google Inc.
+**
+** 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.
+*/
+-->
+<resources>
+
+    <!-- Do not translate. -->
+    <integer-array name="maps_starting_lat_lng">
+        <item>4210484</item>
+        <item>101975766</item>
+    </integer-array>
+    <!-- Do not translate. -->
+    <integer-array name="maps_starting_zoom">
+        <item>4</item>
+    </integer-array>
+
+</resources>
diff --git a/core/res/res/values-sw-rTZ/arrays.xml b/core/res/res/values-sw-rTZ/arrays.xml
new file mode 100644
index 0000000..d1018a7
--- /dev/null
+++ b/core/res/res/values-sw-rTZ/arrays.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/colors.xml
+**
+** Copyright 2006, Google Inc.
+**
+** 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.
+*/
+-->
+<resources>
+
+    <!-- Do not translate. -->
+    <integer-array name="maps_starting_lat_lng">
+        <item>-6369028</item>
+        <item>34888822</item>
+    </integer-array>
+    <!-- Do not translate. -->
+    <integer-array name="maps_starting_zoom">
+        <item>4</item>
+    </integer-array>
+
+</resources>
diff --git a/core/res/res/values-zu-rZA/arrays.xml b/core/res/res/values-zu-rZA/arrays.xml
new file mode 100644
index 0000000..5bff0f4
--- /dev/null
+++ b/core/res/res/values-zu-rZA/arrays.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/colors.xml
+**
+** Copyright 2006, Google Inc.
+**
+** 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.
+*/
+-->
+<resources>
+
+    <!-- Do not translate. -->
+    <integer-array name="maps_starting_lat_lng">
+        <item>-30559482</item>
+        <item>22937506</item>
+    </integer-array>
+    <!-- Do not translate. -->
+    <integer-array name="maps_starting_zoom">
+        <item>4</item>
+    </integer-array>
+
+</resources>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index a59af1a..989adbd 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1661,6 +1661,10 @@
         <attr name="paddingRight" format="dimension" />
         <!-- Sets the padding, in pixels, of the bottom edge; see {@link android.R.attr#padding}. -->
         <attr name="paddingBottom" format="dimension" />
+        <!-- Sets the padding, in pixels, of the start edge; see {@link android.R.attr#padding}. -->
+        <attr name="paddingStart" format="dimension" />
+        <!-- Sets the padding, in pixels, of the end edge; see {@link android.R.attr#padding}. -->
+        <attr name="paddingEnd" format="dimension" />
 
         <!-- Boolean that controls whether a view can take focus.  By default the user can not
              move focus to a view; by setting this attribute to true the view is
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index e02496c..580c204 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1775,4 +1775,7 @@
   <public type="integer" name="status_bar_notification_info_maxnum" />
   <public type="string" name="status_bar_notification_info_overflow" />
 
+  <public type="attr" name="paddingStart"/>
+  <public type="attr" name="paddingEnd"/>
+
 </resources>
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index eeab9b4..e900584 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -79,7 +79,7 @@
 
     /**
      * GRAPHICS_TEXTURE The allcation will be used as a texture
-     * source by one or more graphcics programs.
+     * source by one or more graphics programs.
      *
      */
     public static final int USAGE_GRAPHICS_TEXTURE = 0x0002;
diff --git a/graphics/java/android/renderscript/Element.java b/graphics/java/android/renderscript/Element.java
index 5a72dbe..f844331 100644
--- a/graphics/java/android/renderscript/Element.java
+++ b/graphics/java/android/renderscript/Element.java
@@ -383,6 +383,41 @@
         return rs.mElement_FLOAT_4;
     }
 
+    public static Element F64_2(RenderScript rs) {
+        if(rs.mElement_DOUBLE_2 == null) {
+            rs.mElement_DOUBLE_2 = createVector(rs, DataType.FLOAT_64, 2);
+        }
+        return rs.mElement_DOUBLE_2;
+    }
+
+    public static Element F64_3(RenderScript rs) {
+        if(rs.mElement_DOUBLE_3 == null) {
+            rs.mElement_DOUBLE_3 = createVector(rs, DataType.FLOAT_64, 3);
+        }
+        return rs.mElement_DOUBLE_3;
+    }
+
+    public static Element F64_4(RenderScript rs) {
+        if(rs.mElement_DOUBLE_4 == null) {
+            rs.mElement_DOUBLE_4 = createVector(rs, DataType.FLOAT_64, 4);
+        }
+        return rs.mElement_DOUBLE_4;
+    }
+
+    public static Element U8_2(RenderScript rs) {
+        if(rs.mElement_UCHAR_2 == null) {
+            rs.mElement_UCHAR_2 = createVector(rs, DataType.UNSIGNED_8, 2);
+        }
+        return rs.mElement_UCHAR_2;
+    }
+
+    public static Element U8_3(RenderScript rs) {
+        if(rs.mElement_UCHAR_3 == null) {
+            rs.mElement_UCHAR_3 = createVector(rs, DataType.UNSIGNED_8, 3);
+        }
+        return rs.mElement_UCHAR_3;
+    }
+
     public static Element U8_4(RenderScript rs) {
         if(rs.mElement_UCHAR_4 == null) {
             rs.mElement_UCHAR_4 = createVector(rs, DataType.UNSIGNED_8, 4);
@@ -390,6 +425,153 @@
         return rs.mElement_UCHAR_4;
     }
 
+    public static Element I8_2(RenderScript rs) {
+        if(rs.mElement_CHAR_2 == null) {
+            rs.mElement_CHAR_2 = createVector(rs, DataType.SIGNED_8, 2);
+        }
+        return rs.mElement_CHAR_2;
+    }
+
+    public static Element I8_3(RenderScript rs) {
+        if(rs.mElement_CHAR_3 == null) {
+            rs.mElement_CHAR_3 = createVector(rs, DataType.SIGNED_8, 3);
+        }
+        return rs.mElement_CHAR_3;
+    }
+
+    public static Element I8_4(RenderScript rs) {
+        if(rs.mElement_CHAR_4 == null) {
+            rs.mElement_CHAR_4 = createVector(rs, DataType.SIGNED_8, 4);
+        }
+        return rs.mElement_CHAR_4;
+    }
+
+    public static Element U16_2(RenderScript rs) {
+        if(rs.mElement_USHORT_2 == null) {
+            rs.mElement_USHORT_2 = createVector(rs, DataType.UNSIGNED_16, 2);
+        }
+        return rs.mElement_USHORT_2;
+    }
+
+    public static Element U16_3(RenderScript rs) {
+        if(rs.mElement_USHORT_3 == null) {
+            rs.mElement_USHORT_3 = createVector(rs, DataType.UNSIGNED_16, 3);
+        }
+        return rs.mElement_USHORT_3;
+    }
+
+    public static Element U16_4(RenderScript rs) {
+        if(rs.mElement_USHORT_4 == null) {
+            rs.mElement_USHORT_4 = createVector(rs, DataType.UNSIGNED_16, 4);
+        }
+        return rs.mElement_USHORT_4;
+    }
+
+    public static Element I16_2(RenderScript rs) {
+        if(rs.mElement_SHORT_2 == null) {
+            rs.mElement_SHORT_2 = createVector(rs, DataType.SIGNED_16, 2);
+        }
+        return rs.mElement_SHORT_2;
+    }
+
+    public static Element I16_3(RenderScript rs) {
+        if(rs.mElement_SHORT_3 == null) {
+            rs.mElement_SHORT_3 = createVector(rs, DataType.SIGNED_16, 3);
+        }
+        return rs.mElement_SHORT_3;
+    }
+
+    public static Element I16_4(RenderScript rs) {
+        if(rs.mElement_SHORT_4 == null) {
+            rs.mElement_SHORT_4 = createVector(rs, DataType.SIGNED_16, 4);
+        }
+        return rs.mElement_SHORT_4;
+    }
+
+    public static Element U32_2(RenderScript rs) {
+        if(rs.mElement_UINT_2 == null) {
+            rs.mElement_UINT_2 = createVector(rs, DataType.UNSIGNED_32, 2);
+        }
+        return rs.mElement_UINT_2;
+    }
+
+    public static Element U32_3(RenderScript rs) {
+        if(rs.mElement_UINT_3 == null) {
+            rs.mElement_UINT_3 = createVector(rs, DataType.UNSIGNED_32, 3);
+        }
+        return rs.mElement_UINT_3;
+    }
+
+    public static Element U32_4(RenderScript rs) {
+        if(rs.mElement_UINT_4 == null) {
+            rs.mElement_UINT_4 = createVector(rs, DataType.UNSIGNED_32, 4);
+        }
+        return rs.mElement_UINT_4;
+    }
+
+    public static Element I32_2(RenderScript rs) {
+        if(rs.mElement_INT_2 == null) {
+            rs.mElement_INT_2 = createVector(rs, DataType.SIGNED_32, 2);
+        }
+        return rs.mElement_INT_2;
+    }
+
+    public static Element I32_3(RenderScript rs) {
+        if(rs.mElement_INT_3 == null) {
+            rs.mElement_INT_3 = createVector(rs, DataType.SIGNED_32, 3);
+        }
+        return rs.mElement_INT_3;
+    }
+
+    public static Element I32_4(RenderScript rs) {
+        if(rs.mElement_INT_4 == null) {
+            rs.mElement_INT_4 = createVector(rs, DataType.SIGNED_32, 4);
+        }
+        return rs.mElement_INT_4;
+    }
+
+    public static Element U64_2(RenderScript rs) {
+        if(rs.mElement_ULONG_2 == null) {
+            rs.mElement_ULONG_2 = createVector(rs, DataType.UNSIGNED_64, 2);
+        }
+        return rs.mElement_ULONG_2;
+    }
+
+    public static Element U64_3(RenderScript rs) {
+        if(rs.mElement_ULONG_3 == null) {
+            rs.mElement_ULONG_3 = createVector(rs, DataType.UNSIGNED_64, 3);
+        }
+        return rs.mElement_ULONG_3;
+    }
+
+    public static Element U64_4(RenderScript rs) {
+        if(rs.mElement_ULONG_4 == null) {
+            rs.mElement_ULONG_4 = createVector(rs, DataType.UNSIGNED_64, 4);
+        }
+        return rs.mElement_ULONG_4;
+    }
+
+    public static Element I64_2(RenderScript rs) {
+        if(rs.mElement_LONG_2 == null) {
+            rs.mElement_LONG_2 = createVector(rs, DataType.SIGNED_64, 2);
+        }
+        return rs.mElement_LONG_2;
+    }
+
+    public static Element I64_3(RenderScript rs) {
+        if(rs.mElement_LONG_3 == null) {
+            rs.mElement_LONG_3 = createVector(rs, DataType.SIGNED_64, 3);
+        }
+        return rs.mElement_LONG_3;
+    }
+
+    public static Element I64_4(RenderScript rs) {
+        if(rs.mElement_LONG_4 == null) {
+            rs.mElement_LONG_4 = createVector(rs, DataType.SIGNED_64, 4);
+        }
+        return rs.mElement_LONG_4;
+    }
+
     public static Element MATRIX_4X4(RenderScript rs) {
         if(rs.mElement_MATRIX_4X4 == null) {
             rs.mElement_MATRIX_4X4 = createUser(rs, DataType.MATRIX_4X4);
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 2110e37..9941827 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -613,8 +613,43 @@
     Element mElement_FLOAT_2;
     Element mElement_FLOAT_3;
     Element mElement_FLOAT_4;
+
+    Element mElement_DOUBLE_2;
+    Element mElement_DOUBLE_3;
+    Element mElement_DOUBLE_4;
+
+    Element mElement_UCHAR_2;
+    Element mElement_UCHAR_3;
     Element mElement_UCHAR_4;
 
+    Element mElement_CHAR_2;
+    Element mElement_CHAR_3;
+    Element mElement_CHAR_4;
+
+    Element mElement_USHORT_2;
+    Element mElement_USHORT_3;
+    Element mElement_USHORT_4;
+
+    Element mElement_SHORT_2;
+    Element mElement_SHORT_3;
+    Element mElement_SHORT_4;
+
+    Element mElement_UINT_2;
+    Element mElement_UINT_3;
+    Element mElement_UINT_4;
+
+    Element mElement_INT_2;
+    Element mElement_INT_3;
+    Element mElement_INT_4;
+
+    Element mElement_ULONG_2;
+    Element mElement_ULONG_3;
+    Element mElement_ULONG_4;
+
+    Element mElement_LONG_2;
+    Element mElement_LONG_3;
+    Element mElement_LONG_4;
+
     Element mElement_MATRIX_4X4;
     Element mElement_MATRIX_3X3;
     Element mElement_MATRIX_2X2;
diff --git a/tests/BiDiTests/res/layout/view_padding_mixed.xml b/tests/BiDiTests/res/layout/view_padding_mixed.xml
new file mode 100644
index 0000000..092f55b
--- /dev/null
+++ b/tests/BiDiTests/res/layout/view_padding_mixed.xml
@@ -0,0 +1,135 @@
+<?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/view_padding_mixed"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
+
+    <FrameLayout android:layout_width="match_parent"
+                 android:layout_height="match_parent">
+
+        <FrameLayout
+                android:layout_width="300dp"
+                android:layout_height="300dp"
+                android:layout_gravity="top|left"
+                android:background="#FF888888"
+                android:paddingTop="20dip"
+                android:paddingLeft="40dip"
+                android:paddingStart="5dip"
+                android:paddingBottom="30dip"
+                android:paddingRight="50dip"
+                android:layoutDirection="ltr">
+
+            <FrameLayout
+                    android:layout_width="100dp"
+                    android:layout_height="100dp"
+                    android:layout_gravity="top|left"
+                    android:background="#FF0000FF">
+            </FrameLayout>
+
+            <FrameLayout
+                    android:layout_width="100dp"
+                    android:layout_height="100dp"
+                    android:layout_gravity="bottom|right"
+                    android:background="#FF00FF00">
+            </FrameLayout>
+        </FrameLayout>
+
+        <FrameLayout
+                android:layout_width="300dp"
+                android:layout_height="300dp"
+                android:layout_gravity="top|center_horizontal"
+                android:background="#FF888888"
+                android:paddingTop="20dip"
+                android:paddingLeft="40dip"
+                android:paddingEnd="5dip"
+                android:paddingBottom="30dip"
+                android:paddingRight="50dip"
+                android:layoutDirection="ltr">
+
+            <FrameLayout
+                    android:layout_width="100dp"
+                    android:layout_height="100dp"
+                    android:layout_gravity="top|left"
+                    android:background="#FF0000FF">
+            </FrameLayout>
+
+            <FrameLayout
+                    android:layout_width="100dp"
+                    android:layout_height="100dp"
+                    android:layout_gravity="bottom|right"
+                    android:background="#FF00FF00">
+            </FrameLayout>
+        </FrameLayout>
+
+        <FrameLayout
+                android:layout_width="300dp"
+                android:layout_height="300dp"
+                android:layout_gravity="bottom|left"
+                android:background="#FF888888"
+                android:paddingTop="20dip"
+                android:paddingLeft="40dip"
+                android:paddingStart="5dip"
+                android:paddingBottom="30dip"
+                android:paddingRight="50dip"
+                android:layoutDirection="rtl">
+
+            <FrameLayout
+                    android:layout_width="100dp"
+                    android:layout_height="100dp"
+                    android:layout_gravity="top|left"
+                    android:background="#FF0000FF">
+            </FrameLayout>
+
+            <FrameLayout
+                    android:layout_width="100dp"
+                    android:layout_height="100dp"
+                    android:layout_gravity="bottom|right"
+                    android:background="#FF00FF00">
+            </FrameLayout>
+        </FrameLayout>
+
+        <FrameLayout
+                android:layout_width="300dp"
+                android:layout_height="300dp"
+                android:layout_gravity="bottom|center_horizontal"
+                android:background="#FF888888"
+                android:paddingTop="20dip"
+                android:paddingLeft="40dip"
+                android:paddingEnd="5dip"
+                android:paddingBottom="30dip"
+                android:paddingRight="50dip"
+                android:layoutDirection="rtl">
+
+            <FrameLayout
+                    android:layout_width="100dp"
+                    android:layout_height="100dp"
+                    android:layout_gravity="top|left"
+                    android:background="#FF0000FF">
+            </FrameLayout>
+
+            <FrameLayout
+                    android:layout_width="100dp"
+                    android:layout_height="100dp"
+                    android:layout_gravity="bottom|right"
+                    android:background="#FF00FF00">
+            </FrameLayout>
+        </FrameLayout>
+
+    </FrameLayout>
+
+</FrameLayout>
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
index 0bed7ce..c5e2273 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
@@ -120,6 +120,7 @@
         addItem(result, "Table LOC", BiDiTestTableLayoutLocale.class, R.id.table_layout_locale);
 
         addItem(result, "ViewPadding", BiDiTestViewPadding.class, R.id.view_padding);
+        addItem(result, "ViewPadding MIXED", BiDiTestViewPaddingMixed.class, R.id.view_padding_mixed);
 
         return result;
     }
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestViewPaddingMixed.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestViewPaddingMixed.java
new file mode 100644
index 0000000..7ca2707
--- /dev/null
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestViewPaddingMixed.java
@@ -0,0 +1,17 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+package com.android.bidi;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class BiDiTestViewPaddingMixed extends Fragment {
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.view_padding_mixed, container, false);
+    }
+}