Merge "Support 3D rotations when drawing text" into jb-mr2-dev
diff --git a/api/current.txt b/api/current.txt
index a89c30a..2e9f757 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -27456,7 +27456,7 @@
     method public java.lang.String getUrl();
   }
 
-  public class WebIconDatabase {
+  public deprecated class WebIconDatabase {
     method public void close();
     method public static android.webkit.WebIconDatabase getInstance();
     method public void open(java.lang.String);
@@ -27466,7 +27466,7 @@
     method public void retainIconForPageUrl(java.lang.String);
   }
 
-  public static abstract interface WebIconDatabase.IconListener {
+  public static abstract deprecated interface WebIconDatabase.IconListener {
     method public abstract void onReceivedIcon(java.lang.String, android.graphics.Bitmap);
   }
 
@@ -27505,18 +27505,18 @@
     method public synchronized boolean getJavaScriptCanOpenWindowsAutomatically();
     method public synchronized boolean getJavaScriptEnabled();
     method public synchronized android.webkit.WebSettings.LayoutAlgorithm getLayoutAlgorithm();
-    method public boolean getLightTouchEnabled();
+    method public deprecated boolean getLightTouchEnabled();
     method public boolean getLoadWithOverviewMode();
     method public synchronized boolean getLoadsImagesAutomatically();
     method public boolean getMediaPlaybackRequiresUserGesture();
     method public synchronized int getMinimumFontSize();
     method public synchronized int getMinimumLogicalFontSize();
-    method public synchronized android.webkit.WebSettings.PluginState getPluginState();
+    method public deprecated synchronized android.webkit.WebSettings.PluginState getPluginState();
     method public deprecated synchronized boolean getPluginsEnabled();
     method public deprecated synchronized java.lang.String getPluginsPath();
     method public synchronized java.lang.String getSansSerifFontFamily();
     method public boolean getSaveFormData();
-    method public boolean getSavePassword();
+    method public deprecated boolean getSavePassword();
     method public synchronized java.lang.String getSerifFontFamily();
     method public synchronized java.lang.String getStandardFontFamily();
     method public deprecated synchronized android.webkit.WebSettings.TextSize getTextSize();
@@ -27528,7 +27528,7 @@
     method public abstract void setAllowFileAccessFromFileURLs(boolean);
     method public abstract void setAllowUniversalAccessFromFileURLs(boolean);
     method public synchronized void setAppCacheEnabled(boolean);
-    method public synchronized void setAppCacheMaxSize(long);
+    method public deprecated synchronized void setAppCacheMaxSize(long);
     method public synchronized void setAppCachePath(java.lang.String);
     method public synchronized void setBlockNetworkImage(boolean);
     method public synchronized void setBlockNetworkLoads(boolean);
@@ -27551,20 +27551,20 @@
     method public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean);
     method public synchronized void setJavaScriptEnabled(boolean);
     method public synchronized void setLayoutAlgorithm(android.webkit.WebSettings.LayoutAlgorithm);
-    method public void setLightTouchEnabled(boolean);
+    method public deprecated void setLightTouchEnabled(boolean);
     method public void setLoadWithOverviewMode(boolean);
     method public synchronized void setLoadsImagesAutomatically(boolean);
     method public void setMediaPlaybackRequiresUserGesture(boolean);
     method public synchronized void setMinimumFontSize(int);
     method public synchronized void setMinimumLogicalFontSize(int);
     method public void setNeedInitialFocus(boolean);
-    method public synchronized void setPluginState(android.webkit.WebSettings.PluginState);
+    method public deprecated synchronized void setPluginState(android.webkit.WebSettings.PluginState);
     method public deprecated synchronized void setPluginsEnabled(boolean);
     method public deprecated synchronized void setPluginsPath(java.lang.String);
-    method public synchronized void setRenderPriority(android.webkit.WebSettings.RenderPriority);
+    method public deprecated synchronized void setRenderPriority(android.webkit.WebSettings.RenderPriority);
     method public synchronized void setSansSerifFontFamily(java.lang.String);
     method public void setSaveFormData(boolean);
-    method public void setSavePassword(boolean);
+    method public deprecated void setSavePassword(boolean);
     method public synchronized void setSerifFontFamily(java.lang.String);
     method public synchronized void setStandardFontFamily(java.lang.String);
     method public synchronized void setSupportMultipleWindows(boolean);
@@ -27631,7 +27631,7 @@
     method public void getOrigins(android.webkit.ValueCallback<java.util.Map>);
     method public void getQuotaForOrigin(java.lang.String, android.webkit.ValueCallback<java.lang.Long>);
     method public void getUsageForOrigin(java.lang.String, android.webkit.ValueCallback<java.lang.Long>);
-    method public void setQuotaForOrigin(java.lang.String, long);
+    method public deprecated void setQuotaForOrigin(java.lang.String, long);
   }
 
   public static class WebStorage.Origin {
@@ -27674,7 +27674,7 @@
     method public void clearHistory();
     method public void clearMatches();
     method public void clearSslPreferences();
-    method public void clearView();
+    method public deprecated void clearView();
     method public android.webkit.WebBackForwardList copyBackForwardList();
     method public void destroy();
     method public void documentHasImages(android.os.Message);
@@ -27721,7 +27721,7 @@
     method public void requestImageRef(android.os.Message);
     method public android.webkit.WebBackForwardList restoreState(android.os.Bundle);
     method public void resumeTimers();
-    method public void savePassword(java.lang.String, java.lang.String, java.lang.String);
+    method public deprecated void savePassword(java.lang.String, java.lang.String, java.lang.String);
     method public android.webkit.WebBackForwardList saveState(android.os.Bundle);
     method public void saveWebArchive(java.lang.String);
     method public void saveWebArchive(java.lang.String, boolean, android.webkit.ValueCallback<java.lang.String>);
@@ -27737,7 +27737,7 @@
     method public void setVerticalScrollbarOverlay(boolean);
     method public void setWebChromeClient(android.webkit.WebChromeClient);
     method public void setWebViewClient(android.webkit.WebViewClient);
-    method public boolean showFindDialog(java.lang.String, boolean);
+    method public deprecated boolean showFindDialog(java.lang.String, boolean);
     method public void stopLoading();
     method public boolean zoomIn();
     method public boolean zoomOut();
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 1bbfb5d..b00bf09 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -1137,8 +1137,7 @@
      * Get the profile proxy object associated with the profile.
      *
      * <p>Profile can be one of {@link BluetoothProfile#HEALTH}, {@link BluetoothProfile#HEADSET},
-     * {@link BluetoothProfile#A2DP}, {@link BluetoothProfile#GATT},
-     * or {@link BluetoothProfile#GATT_SERVER}. Clients must implements
+     * or {@link BluetoothProfile#A2DP}. Clients must implement
      * {@link BluetoothProfile.ServiceListener} to get notified of
      * the connection status and to get the proxy object.
      *
diff --git a/core/java/android/webkit/WebIconDatabase.java b/core/java/android/webkit/WebIconDatabase.java
index 99f20ff..e574593 100644
--- a/core/java/android/webkit/WebIconDatabase.java
+++ b/core/java/android/webkit/WebIconDatabase.java
@@ -25,11 +25,19 @@
  * and WebView.getIconDatabase() will return a WebIconDatabase object. This
  * WebIconDatabase object is a single instance and all methods operate on that
  * single object.
+ * The main use-case for this class is calling {@link #open}
+ * to enable favicon functionality on all WebView instances in this process.
+ *
+ * @deprecated This class is only required when running on devices
+ *             up to {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
  */
+@Deprecated
 public class WebIconDatabase {
     /**
      * Interface for receiving icons from the database.
+     * @deprecated This interface is obsolete.
      */
+    @Deprecated
     public interface IconListener {
         /**
          * Called when the icon has been retrieved from the database and the
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 728bcd3..0ab49ac 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -422,7 +422,9 @@
 
     /**
      * Sets whether the WebView should save passwords. The default is true.
+     * @deprecated Saving passwords in WebView will not be supported in future versions.
      */
+    @Deprecated
     public void setSavePassword(boolean save) {
         throw new MustOverrideException();
     }
@@ -432,7 +434,9 @@
      *
      * @return whether the WebView saves passwords
      * @see #setSavePassword
+     * @deprecated Saving passwords in WebView will not be supported in future versions.
      */
+    @Deprecated
     public boolean getSavePassword() {
         throw new MustOverrideException();
     }
@@ -515,18 +519,20 @@
 
     /**
      * Enables using light touches to make a selection and activate mouseovers.
-     * The default is false.
+     * @deprecated From {@link android.os.Build.VERSION_CODES#JELLY_BEAN} this
+     *             setting is obsolete and has no effect.
      */
+    @Deprecated
     public void setLightTouchEnabled(boolean enabled) {
         throw new MustOverrideException();
     }
 
     /**
      * Gets whether light touches are enabled.
-     *
-     * @return whether light touches are enabled
      * @see #setLightTouchEnabled
+     * @deprecated This setting is obsolete.
      */
+    @Deprecated
     public boolean getLightTouchEnabled() {
         throw new MustOverrideException();
     }
@@ -1012,7 +1018,9 @@
      * {@link PluginState#OFF}.
      *
      * @param state a PluginState value
+     * @deprecated Plugins will not be supported in future, and should not be used.
      */
+    @Deprecated
     public synchronized void setPluginState(PluginState state) {
         throw new MustOverrideException();
     }
@@ -1091,9 +1099,12 @@
      * this should be viewed as a guide, not a hard limit. Setting the
      * size to a value less than current database size does not cause the
      * database to be trimmed. The default size is {@link Long#MAX_VALUE}.
+     * It is recommended to leave the maximum size set to the default value.
      *
      * @param appCacheMaxSize the maximum size in bytes
+     * @deprecated In future quota will be managed automatically.
      */
+    @Deprecated
     public synchronized void setAppCacheMaxSize(long appCacheMaxSize) {
         throw new MustOverrideException();
     }
@@ -1219,7 +1230,9 @@
      *
      * @return the plugin state as a {@link PluginState} value
      * @see #setPluginState
+     * @deprecated Plugins will not be supported in future, and should not be used.
      */
+    @Deprecated
     public synchronized PluginState getPluginState() {
         throw new MustOverrideException();
     }
@@ -1324,7 +1337,10 @@
      * {@link RenderPriority#NORMAL}.
      *
      * @param priority the priority
+     * @deprecated It is not recommended to adjust thread priorities, and this will
+     *             not be supported in future versions.
      */
+    @Deprecated
     public synchronized void setRenderPriority(RenderPriority priority) {
         throw new MustOverrideException();
     }
diff --git a/core/java/android/webkit/WebStorage.java b/core/java/android/webkit/WebStorage.java
index 1e955bd..7d9373c 100644
--- a/core/java/android/webkit/WebStorage.java
+++ b/core/java/android/webkit/WebStorage.java
@@ -171,7 +171,9 @@
      * The quota is specified in bytes and the origin is specified using its string
      * representation. Note that a quota is not enforced on a per-origin basis
      * for the Application Cache API.
+     * @deprecated Controlling quota per-origin will not be supported in future.
      */
+    @Deprecated
     public void setQuotaForOrigin(String origin, long quota) {
         // Must be a no-op for backward compatibility: see the hidden constructor for reason.
     }
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index dcb664e..f3983187 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -602,7 +602,9 @@
      * @param password the password for the given host
      * @see WebViewDatabase#clearUsernamePassword
      * @see WebViewDatabase#hasUsernamePassword
+     * @deprecated Saving passwords in WebView will not be supported in future versions.
      */
+    @Deprecated
     public void savePassword(String host, String username, String password) {
         checkThread();
         mProvider.savePassword(host, username, password);
@@ -999,7 +1001,10 @@
     /**
      * Clears this WebView so that onDraw() will draw nothing but white background,
      * and onMeasure() will return 0 if MeasureSpec is not MeasureSpec.EXACTLY.
+     * @deprecated Use WebView.loadUrl("about:blank") to reliably reset the view state
+     *             and release page resources (including any running JavaScript).
      */
+    @Deprecated
     public void clearView() {
         checkThread();
         mProvider.clearView();
@@ -1389,7 +1394,11 @@
      * @param showIme if true, show the IME, assuming the user will begin typing.
      *                If false and text is non-null, perform a find all.
      * @return true if the find dialog is shown, false otherwise
+     * @deprecated This method does not work reliably on all Android versions;
+     *             implementing a custom find dialog using WebView.findAllAsync()
+     *             provides a more robust solution.
      */
+    @Deprecated
     public boolean showFindDialog(String text, boolean showIme) {
         checkThread();
         return mProvider.showFindDialog(text, showIme);
diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java
index f041f07..db20549 100644
--- a/core/java/com/android/internal/app/ActionBarImpl.java
+++ b/core/java/com/android/internal/app/ActionBarImpl.java
@@ -110,6 +110,7 @@
 
     private int mCurWindowVisibility = View.VISIBLE;
 
+    private boolean mContentAnimations = true;
     private boolean mHiddenByApp;
     private boolean mHiddenBySystem;
     private boolean mShowingForMode;
@@ -122,7 +123,7 @@
     final AnimatorListener mHideListener = new AnimatorListenerAdapter() {
         @Override
         public void onAnimationEnd(Animator animation) {
-            if (mContentView != null) {
+            if (mContentAnimations && mContentView != null) {
                 mContentView.setTranslationY(0);
                 mTopVisibilityView.setTranslationY(0);
             }
@@ -151,23 +152,24 @@
         mActivity = activity;
         Window window = activity.getWindow();
         View decor = window.getDecorView();
-        init(decor);
-        if (!mActivity.getWindow().hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY)) {
+        boolean overlayMode = mActivity.getWindow().hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
+        init(decor, overlayMode);
+        if (!overlayMode) {
             mContentView = decor.findViewById(android.R.id.content);
         }
     }
 
     public ActionBarImpl(Dialog dialog) {
         mDialog = dialog;
-        init(dialog.getWindow().getDecorView());
+        init(dialog.getWindow().getDecorView(), false);
     }
 
-    private void init(View decor) {
+    private void init(View decor, boolean overlayMode) {
         mContext = decor.getContext();
         mOverlayLayout = (ActionBarOverlayLayout) decor.findViewById(
                 com.android.internal.R.id.action_bar_overlay_layout);
         if (mOverlayLayout != null) {
-            mOverlayLayout.setActionBar(this);
+            mOverlayLayout.setActionBar(this, overlayMode);
         }
         mActionView = (ActionBarView) decor.findViewById(com.android.internal.R.id.action_bar);
         mContextView = (ActionBarContextView) decor.findViewById(
@@ -586,6 +588,10 @@
         return mContainerView.getHeight();
     }
 
+    public void enableContentAnimations(boolean enabled) {
+        mContentAnimations = enabled;
+    }
+
     @Override
     public void show() {
         if (mHiddenByApp) {
@@ -684,7 +690,7 @@
             AnimatorSet anim = new AnimatorSet();
             AnimatorSet.Builder b = anim.play(ObjectAnimator.ofFloat(mTopVisibilityView,
                     "translationY", 0));
-            if (mContentView != null) {
+            if (mContentAnimations && mContentView != null) {
                 b.with(ObjectAnimator.ofFloat(mContentView, "translationY",
                         startingY, 0));
             }
@@ -709,7 +715,7 @@
         } else {
             mTopVisibilityView.setAlpha(1);
             mTopVisibilityView.setTranslationY(0);
-            if (mContentView != null) {
+            if (mContentAnimations && mContentView != null) {
                 mContentView.setTranslationY(0);
             }
             if (mSplitView != null && mContextDisplayMode == CONTEXT_DISPLAY_SPLIT) {
@@ -742,7 +748,7 @@
             }
             AnimatorSet.Builder b = anim.play(ObjectAnimator.ofFloat(mTopVisibilityView,
                     "translationY", endingY));
-            if (mContentView != null) {
+            if (mContentAnimations && mContentView != null) {
                 b.with(ObjectAnimator.ofFloat(mContentView, "translationY",
                         0, endingY));
             }
diff --git a/core/java/com/android/internal/widget/ActionBarOverlayLayout.java b/core/java/com/android/internal/widget/ActionBarOverlayLayout.java
index 18a696e..482eba7 100644
--- a/core/java/com/android/internal/widget/ActionBarOverlayLayout.java
+++ b/core/java/com/android/internal/widget/ActionBarOverlayLayout.java
@@ -40,6 +40,7 @@
     private ActionBarContainer mContainerView;
     private ActionBarView mActionView;
     private View mActionBarBottom;
+    private boolean mOverlayMode;
     private int mLastSystemUiVisibility;
     private final Rect mLocalInsets = new Rect();
 
@@ -63,8 +64,13 @@
         ta.recycle();
     }
 
-    public void setActionBar(ActionBarImpl impl) {
+    public void setOverlayMode(boolean mode) {
+        mOverlayMode = mode;
+    }
+
+    public void setActionBar(ActionBarImpl impl, boolean overlayMode) {
         mActionBar = impl;
+        mOverlayMode = overlayMode;
         if (getWindowToken() != null) {
             // This is being initialized after being added to a window;
             // make sure to update all state now.
@@ -105,8 +111,13 @@
         mLastSystemUiVisibility = visible;
         final boolean barVisible = (visible&SYSTEM_UI_FLAG_FULLSCREEN) == 0;
         final boolean wasVisible = mActionBar != null ? mActionBar.isSystemShowing() : true;
+        final boolean stable = (visible&SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0;
         if (mActionBar != null) {
-            if (barVisible) mActionBar.showForSystem();
+            // We want the bar to be visible if it is not being hidden,
+            // or the app has not turned on a stable UI mode (meaning they
+            // are performing explicit layout around the action bar).
+            mActionBar.enableContentAnimations(!stable);
+            if (barVisible || !stable) mActionBar.showForSystem();
             else mActionBar.hideForSystem();
         }
         if ((diff&SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0) {
@@ -161,35 +172,42 @@
             changed |= applyInsets(mActionBarBottom, insets, true, false, true, true);
         }
 
+        int topSpace = 0;
+        if (stable || mActionBarTop.getVisibility() == VISIBLE) {
+            // This is the space needed on top of the window for the action bar.
+            topSpace = mActionBarHeight;
+        }
+        if (mActionBar != null && mActionBar.hasNonEmbeddedTabs()) {
+            View tabs = mContainerView.getTabContainer();
+            if (tabs != null && (stable || tabs.getVisibility() == VISIBLE)) {
+                // If tabs are not embedded, increase space on top to account for them.
+                topSpace += mActionBarHeight;
+            }
+        }
+
+        int bottomSpace = 0;
+        if (mActionView.isSplitActionBar()) {
+            if ((mActionBarBottom != null
+                    && (stable || mActionBarBottom.getVisibility() == VISIBLE))) {
+                // If action bar is split, adjust bottom insets for it.
+                bottomSpace = mActionBarHeight;
+            }
+        }
+
         // If the window has not requested system UI layout flags, we need to
         // make sure its content is not being covered by system UI...  though it
         // will still be covered by the action bar since they have requested it to
         // overlay.
         boolean res = computeFitSystemWindows(insets, mLocalInsets);
+        if (!mOverlayMode && !stable) {
+            mLocalInsets.top += topSpace;
+            mLocalInsets.bottom += bottomSpace;
+        } else {
+            insets.top += topSpace;
+            insets.bottom += bottomSpace;
+        }
         changed |= applyInsets(mContent, mLocalInsets, true, true, true, true);
 
-
-        if (stable || mActionBarTop.getVisibility() == VISIBLE) {
-            // The action bar creates additional insets for its content to use.
-            insets.top += mActionBarHeight;
-        }
-
-        if (mActionBar != null && mActionBar.hasNonEmbeddedTabs()) {
-            View tabs = mContainerView.getTabContainer();
-            if (stable || (tabs != null && tabs.getVisibility() == VISIBLE)) {
-                // If tabs are not embedded, adjust insets to account for them.
-                insets.top += mActionBarHeight;
-            }
-        }
-
-        if (mActionView.isSplitActionBar()) {
-            if (stable || (mActionBarBottom != null
-                    && mActionBarBottom.getVisibility() == VISIBLE)) {
-                // If action bar is split, adjust bottom insets for it.
-                insets.bottom += mActionBarHeight;
-            }
-        }
-
         if (changed) {
             requestLayout();
         }
diff --git a/core/res/res/layout/screen_action_bar.xml b/core/res/res/layout/screen_action_bar.xml
index f0b2313..95519c6 100644
--- a/core/res/res/layout/screen_action_bar.xml
+++ b/core/res/res/layout/screen_action_bar.xml
@@ -18,38 +18,47 @@
 This is an optimized layout for a screen with the Action Bar enabled.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.internal.widget.ActionBarOverlayLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/action_bar_overlay_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="vertical"
-    android:fitsSystemWindows="true"
     android:splitMotionEvents="false">
-    <com.android.internal.widget.ActionBarContainer android:id="@+id/action_bar_container"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        style="?android:attr/actionBarStyle">
-        <com.android.internal.widget.ActionBarView
-            android:id="@+id/action_bar"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            style="?android:attr/actionBarStyle" />
-        <com.android.internal.widget.ActionBarContextView
-            android:id="@+id/action_context_bar"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:visibility="gone"
-            style="?android:attr/actionModeStyle" />
-    </com.android.internal.widget.ActionBarContainer>
     <FrameLayout android:id="@android:id/content"
-        android:layout_width="match_parent" 
-        android:layout_height="0dip"
-        android:layout_weight="1"
-        android:foregroundGravity="fill_horizontal|top"
-        android:foreground="?android:attr/windowContentOverlay" />
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
+    <LinearLayout android:id="@+id/top_action_bar"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_gravity="top">
+        <com.android.internal.widget.ActionBarContainer android:id="@+id/action_bar_container"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alignParentTop="true"
+            style="?android:attr/actionBarStyle"
+            android:gravity="top">
+            <com.android.internal.widget.ActionBarView
+                android:id="@+id/action_bar"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                style="?android:attr/actionBarStyle" />
+            <com.android.internal.widget.ActionBarContextView
+                android:id="@+id/action_context_bar"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:visibility="gone"
+                style="?android:attr/actionModeStyle" />
+        </com.android.internal.widget.ActionBarContainer>
+        <ImageView android:src="?android:attr/windowContentOverlay"
+                   android:scaleType="fitXY"
+                   android:layout_width="match_parent"
+                   android:layout_height="wrap_content" />
+    </LinearLayout>
     <com.android.internal.widget.ActionBarContainer android:id="@+id/split_action_bar"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
+                  android:layout_gravity="bottom"
                   style="?android:attr/actionBarSplitStyle"
                   android:visibility="gone"
                   android:gravity="center"/>
-</LinearLayout>
+</com.android.internal.widget.ActionBarOverlayLayout>
diff --git a/core/res/res/layout/screen_action_bar_overlay.xml b/core/res/res/layout/screen_action_bar_overlay.xml
deleted file mode 100644
index c8181d1..0000000
--- a/core/res/res/layout/screen_action_bar_overlay.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<!--
-This is an optimized layout for a screen with
-the Action Bar enabled overlaying application content.
--->
-
-<com.android.internal.widget.ActionBarOverlayLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/action_bar_overlay_layout"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:splitMotionEvents="false">
-    <FrameLayout android:id="@android:id/content"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent" />
-    <LinearLayout android:id="@+id/top_action_bar"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_gravity="top">
-        <com.android.internal.widget.ActionBarContainer android:id="@+id/action_bar_container"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_alignParentTop="true"
-            style="?android:attr/actionBarStyle"
-            android:gravity="top">
-            <com.android.internal.widget.ActionBarView
-                android:id="@+id/action_bar"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                style="?android:attr/actionBarStyle" />
-            <com.android.internal.widget.ActionBarContextView
-                android:id="@+id/action_context_bar"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:visibility="gone"
-                style="?android:attr/actionModeStyle" />
-        </com.android.internal.widget.ActionBarContainer>
-        <ImageView android:src="?android:attr/windowContentOverlay"
-                   android:scaleType="fitXY"
-                   android:layout_width="match_parent"
-                   android:layout_height="wrap_content" />
-    </LinearLayout>
-    <com.android.internal.widget.ActionBarContainer android:id="@+id/split_action_bar"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_gravity="bottom"
-                  style="?android:attr/actionBarSplitStyle"
-                  android:visibility="gone"
-                  android:gravity="center"/>
-</com.android.internal.widget.ActionBarOverlayLayout>
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index a99cdad..b8564b6 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -26,6 +26,7 @@
 import android.graphics.SurfaceTexture;
 import android.util.Log;
 import android.util.TypedValue;
+import android.graphics.Canvas;
 
 /**
  * <p>
@@ -429,6 +430,9 @@
 
     private void validateBitmapFormat(Bitmap b) {
         Bitmap.Config bc = b.getConfig();
+        if (bc == null) {
+            throw new RSIllegalArgumentException("Bitmap has an unsupported format for this operation");
+        }
         switch (bc) {
         case ALPHA_8:
             if (mType.getElement().mKind != Element.DataKind.PIXEL_A) {
@@ -612,6 +616,13 @@
      */
     public void copyFrom(Bitmap b) {
         mRS.validate();
+        if (b.getConfig() == null) {
+            Bitmap newBitmap = Bitmap.createBitmap(b.getWidth(), b.getHeight(), Bitmap.Config.ARGB_8888);
+            Canvas c = new Canvas(newBitmap);
+            c.drawBitmap(b, 0, 0, null);
+            copyFrom(newBitmap);
+            return;
+        }
         validateBitmapSize(b);
         validateBitmapFormat(b);
         mRS.nAllocationCopyFromBitmap(getID(mRS), b);
@@ -951,6 +962,12 @@
      */
     public void copy2DRangeFrom(int xoff, int yoff, Bitmap data) {
         mRS.validate();
+        if (data.getConfig() == null) {
+            Bitmap newBitmap = Bitmap.createBitmap(data.getWidth(), data.getHeight(), Bitmap.Config.ARGB_8888);
+            Canvas c = new Canvas(newBitmap);
+            c.drawBitmap(data, 0, 0, null);
+            copy2DRangeFrom(xoff, yoff, newBitmap);
+        }
         validateBitmapFormat(data);
         validate2DRange(xoff, yoff, data.getWidth(), data.getHeight());
         mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID, data);
@@ -1220,6 +1237,18 @@
                                               MipmapControl mips,
                                               int usage) {
         rs.validate();
+
+        // WAR undocumented color formats
+        if (b.getConfig() == null) {
+            if ((usage & USAGE_SHARED) != 0) {
+                throw new RSIllegalArgumentException("USAGE_SHARED cannot be used with a Bitmap that has a null config.");
+            }
+            Bitmap newBitmap = Bitmap.createBitmap(b.getWidth(), b.getHeight(), Bitmap.Config.ARGB_8888);
+            Canvas c = new Canvas(newBitmap);
+            c.drawBitmap(b, 0, 0, null);
+            return createFromBitmap(rs, newBitmap, mips, usage);
+        }
+
         Type t = typeFromBitmap(rs, b, mips);
 
         // enable optimized bitmap path only with no mipmap and script-only usage
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index 9db8fe8..9ecfb5a 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -1140,9 +1140,20 @@
             const float* positions, SkPaint* paint, float length)
             : DrawBoundedOp(paint), mText(text), mBytesCount(bytesCount), mCount(count),
             mX(x), mY(y), mPositions(positions), mLength(length) {
+        // duplicates bounds calculation from OpenGLRenderer::drawText, but doesn't alter mX
         SkPaint::FontMetrics metrics;
         paint->getFontMetrics(&metrics, 0.0f);
-        mLocalBounds.set(mX, mY + metrics.fTop, mX + length, mY + metrics.fBottom);
+        switch (paint->getTextAlign()) {
+        case SkPaint::kCenter_Align:
+            x -= length / 2.0f;
+            break;
+        case SkPaint::kRight_Align:
+            x -= length;
+            break;
+        default:
+            break;
+        }
+        mLocalBounds.set(x, mY + metrics.fTop, x + length, mY + metrics.fBottom);
     }
 
     virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, uint32_t level,
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index e1d9b73..5ad305c 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -33,6 +33,7 @@
 import com.android.internal.view.menu.MenuView;
 import com.android.internal.widget.ActionBarContainer;
 import com.android.internal.widget.ActionBarContextView;
+import com.android.internal.widget.ActionBarOverlayLayout;
 import com.android.internal.widget.ActionBarView;
 
 import android.app.KeyguardManager;
@@ -2788,11 +2789,7 @@
                         com.android.internal.R.attr.dialogTitleDecorLayout, res, true);
                 layoutResource = res.resourceId;
             } else if ((features & (1 << FEATURE_ACTION_BAR)) != 0) {
-                if ((features & (1 << FEATURE_ACTION_BAR_OVERLAY)) != 0) {
-                    layoutResource = com.android.internal.R.layout.screen_action_bar_overlay;
-                } else {
-                    layoutResource = com.android.internal.R.layout.screen_action_bar;
-                }
+                layoutResource = com.android.internal.R.layout.screen_action_bar;
             } else {
                 layoutResource = com.android.internal.R.layout.screen_title;
             }
diff --git a/tests/FrameworkPerf/src/com/android/frameworkperf/FrameworkPerfActivity.java b/tests/FrameworkPerf/src/com/android/frameworkperf/FrameworkPerfActivity.java
index 30a968f..6633787 100644
--- a/tests/FrameworkPerf/src/com/android/frameworkperf/FrameworkPerfActivity.java
+++ b/tests/FrameworkPerf/src/com/android/frameworkperf/FrameworkPerfActivity.java
@@ -272,7 +272,7 @@
                 args.bgOp = mCurOpIndex;
             } else {
                 args.fgOp = mCurOpIndex;
-                args.bgOp = mFgTestIndex;
+                args.bgOp = mBgTestIndex;
             }
         }
         Bundle bundle = new Bundle();
@@ -424,6 +424,8 @@
             updateWakeLock();
             stopService(new Intent(this, SchedulerService.class));
             synchronized (mResults) {
+                Log.i("PerfRes", "\tTEST\tFgOps\tFgMsPerOp\tFgTime\tFgName\tBgOps\tBgMsPerOp\t"
+                        + "BgTime\tBgName");
                 for (int i=0; i<mResults.size(); i++) {
                     RunResult result = mResults.get(i);
                     float fgMsPerOp = result.getFgMsPerOp();
diff --git a/tests/FrameworkPerf/src/com/android/frameworkperf/TestService.java b/tests/FrameworkPerf/src/com/android/frameworkperf/TestService.java
index a8c43e9..5f4f006 100644
--- a/tests/FrameworkPerf/src/com/android/frameworkperf/TestService.java
+++ b/tests/FrameworkPerf/src/com/android/frameworkperf/TestService.java
@@ -300,7 +300,7 @@
                     threadFinished(false);
                 }
             }, Process.THREAD_PRIORITY_BACKGROUND);
-            mForegroundThread = new RunnerThread("background", new Runnable() {
+            mForegroundThread = new RunnerThread("foreground", new Runnable() {
                 @Override public void run() {
                     boolean running;
                     int ops = 0;