Merge "Fix for an IOOBoundsException in Paint." into honeycomb
diff --git a/api/current.xml b/api/current.xml
index 28efc7e..ebfcdaf 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -11809,6 +11809,28 @@
  visibility="public"
 >
 </field>
+<field name="dialog_holo_dark_frame"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="17301682"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="dialog_holo_light_frame"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="17301683"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="divider_horizontal_bright"
  type="int"
  transient="false"
@@ -26585,6 +26607,39 @@
 <parameter name="viewSpacingBottom" type="int">
 </parameter>
 </method>
+<field name="THEME_HOLO_DARK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="THEME_HOLO_LIGHT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="THEME_TRADITIONAL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 </class>
 <class name="AlertDialog.Builder"
  extends="java.lang.Object"
@@ -260471,7 +260526,7 @@
  deprecated="not deprecated"
  visibility="public"
 >
-<parameter name="t" type="T">
+<parameter name="arg0" type="T">
 </parameter>
 </method>
 </interface>
diff --git a/core/java/android/app/AlertDialog.java b/core/java/android/app/AlertDialog.java
index 428f4e3..e83d104 100644
--- a/core/java/android/app/AlertDialog.java
+++ b/core/java/android/app/AlertDialog.java
@@ -58,29 +58,69 @@
 public class AlertDialog extends Dialog implements DialogInterface {
     private AlertController mAlert;
 
+    /**
+     * Special theme constant for {@link #AlertDialog(Context, int)}: use
+     * the traditional (pre-Holo) alert dialog theme.
+     */
+    public static final int THEME_TRADITIONAL = 1;
+    
+    /**
+     * Special theme constant for {@link #AlertDialog(Context, int)}: use
+     * the holographic alert theme with a dark background.
+     */
+    public static final int THEME_HOLO_DARK = 2;
+    
+    /**
+     * Special theme constant for {@link #AlertDialog(Context, int)}: use
+     * the holographic alert theme with a light background.
+     */
+    public static final int THEME_HOLO_LIGHT = 3;
+    
     protected AlertDialog(Context context) {
-        this(context, getDefaultDialogTheme(context));
+        this(context, resolveDialogTheme(context, 0), true);
     }
 
+    /**
+     * Construct an AlertDialog that uses an explicit theme.  The actual style
+     * that an AlertDialog uses is a private implementation, however you can
+     * here supply either the name of an attribute in the theme from which
+     * to get the dialog's style (such as {@link android.R.attr#alertDialogTheme}
+     * or one of the constants {@link #THEME_TRADITIONAL},
+     * {@link #THEME_HOLO_DARK}, or {@link #THEME_HOLO_LIGHT}.
+     */
     protected AlertDialog(Context context, int theme) {
-        super(context, theme == 0 ? getDefaultDialogTheme(context) : theme);
+        this(context, theme, true);
+    }
+
+    AlertDialog(Context context, int theme, boolean createContextWrapper) {
+        super(context, resolveDialogTheme(context, theme), createContextWrapper);
         mWindow.alwaysReadCloseOnTouchAttr();
-        mAlert = new AlertController(context, this, getWindow());
+        mAlert = new AlertController(getContext(), this, getWindow());
     }
 
     protected AlertDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
-        super(context, getDefaultDialogTheme(context));
+        super(context, resolveDialogTheme(context, 0));
         mWindow.alwaysReadCloseOnTouchAttr();
         setCancelable(cancelable);
         setOnCancelListener(cancelListener);
         mAlert = new AlertController(context, this, getWindow());
     }
 
-    private static int getDefaultDialogTheme(Context context) {
-        TypedValue outValue = new TypedValue();
-        context.getTheme().resolveAttribute(com.android.internal.R.attr.alertDialogTheme,
-                outValue, true);
-        return outValue.resourceId;
+    static int resolveDialogTheme(Context context, int resid) {
+        if (resid == THEME_TRADITIONAL) {
+            return com.android.internal.R.style.Theme_Dialog_Alert;
+        } else if (resid == THEME_HOLO_DARK) {
+            return com.android.internal.R.style.Theme_Holo_Dialog_Alert;
+        } else if (resid == THEME_HOLO_LIGHT) {
+            return com.android.internal.R.style.Theme_Holo_Light_Dialog_Alert;
+        } else if (resid >= 0x01000000) {   // start of real resource IDs.
+            return resid;
+        } else {
+            TypedValue outValue = new TypedValue();
+            context.getTheme().resolveAttribute(com.android.internal.R.attr.alertDialogTheme,
+                    outValue, true);
+            return outValue.resourceId;
+        }
     }
 
     /**
@@ -294,15 +334,23 @@
          * Constructor using a context for this builder and the {@link AlertDialog} it creates.
          */
         public Builder(Context context) {
-            this(context, getDefaultDialogTheme(context));
+            this(context, resolveDialogTheme(context, 0));
         }
 
         /**
          * Constructor using a context and theme for this builder and
-         * the {@link AlertDialog} it creates.
+         * the {@link AlertDialog} it creates.  The actual theme
+         * that an AlertDialog uses is a private implementation, however you can
+         * here supply either the name of an attribute in the theme from which
+         * to get the dialog's style (such as {@link android.R.attr#alertDialogTheme}
+         * or one of the constants
+         * {@link AlertDialog#THEME_TRADITIONAL AlertDialog.THEME_TRADITIONAL},
+         * {@link AlertDialog#THEME_HOLO_DARK AlertDialog.THEME_HOLO_DARK}, or
+         * {@link AlertDialog#THEME_HOLO_LIGHT AlertDialog.THEME_HOLO_LIGHT}.
          */
         public Builder(Context context, int theme) {
-            P = new AlertController.AlertParams(new ContextThemeWrapper(context, theme));
+            P = new AlertController.AlertParams(new ContextThemeWrapper(
+                    context, resolveDialogTheme(context, theme)));
             mTheme = theme;
         }
         
@@ -840,7 +888,7 @@
          * to do and want this to be created and displayed.
          */
         public AlertDialog create() {
-            final AlertDialog dialog = new AlertDialog(P.mContext, mTheme);
+            final AlertDialog dialog = new AlertDialog(P.mContext, mTheme, false);
             P.apply(dialog.mAlert);
             dialog.setCancelable(P.mCancelable);
             dialog.setOnCancelListener(P.mOnCancelListener);
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java
index f4fa567..23d4065 100644
--- a/core/java/android/app/Dialog.java
+++ b/core/java/android/app/Dialog.java
@@ -119,7 +119,7 @@
      *                present its UI.
      */
     public Dialog(Context context) {
-        this(context, 0);
+        this(context, 0, true);
     }
 
     /**
@@ -135,6 +135,10 @@
      * <var>context</var>.  If 0, the default dialog theme will be used.
      */
     public Dialog(Context context, int theme) {
+        this(context, theme, true);
+    }
+
+    Dialog(Context context, int theme, boolean createContextWrapper) {
         if (theme == 0) {
             TypedValue outValue = new TypedValue();
             context.getTheme().resolveAttribute(com.android.internal.R.attr.dialogTheme,
@@ -142,7 +146,7 @@
             theme = outValue.resourceId;
         }
 
-        mContext = new ContextThemeWrapper(context, theme);
+        mContext = createContextWrapper ? new ContextThemeWrapper(context, theme) : context;
         mWindowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
         Window w = PolicyManager.makeNewWindow(mContext);
         mWindow = w;
@@ -152,7 +156,7 @@
         mUiThread = Thread.currentThread();
         mListenersHandler = new ListenersHandler(this);
     }
-
+    
     /**
      * @deprecated
      * @hide
diff --git a/core/java/android/view/MenuInflater.java b/core/java/android/view/MenuInflater.java
index ab515c9..372ac15 100644
--- a/core/java/android/view/MenuInflater.java
+++ b/core/java/android/view/MenuInflater.java
@@ -228,8 +228,8 @@
         private boolean itemAdded;
         private int itemId;
         private int itemCategoryOrder;
-        private String itemTitle;
-        private String itemTitleCondensed;
+        private CharSequence itemTitle;
+        private CharSequence itemTitleCondensed;
         private int itemIconResId;
         private char itemAlphabeticShortcut;
         private char itemNumericShortcut;
@@ -311,8 +311,8 @@
             final int category = a.getInt(com.android.internal.R.styleable.MenuItem_menuCategory, groupCategory);
             final int order = a.getInt(com.android.internal.R.styleable.MenuItem_orderInCategory, groupOrder);
             itemCategoryOrder = (category & Menu.CATEGORY_MASK) | (order & Menu.USER_MASK);
-            itemTitle = a.getString(com.android.internal.R.styleable.MenuItem_title);
-            itemTitleCondensed = a.getString(com.android.internal.R.styleable.MenuItem_titleCondensed);
+            itemTitle = a.getText(com.android.internal.R.styleable.MenuItem_title);
+            itemTitleCondensed = a.getText(com.android.internal.R.styleable.MenuItem_titleCondensed);
             itemIconResId = a.getResourceId(com.android.internal.R.styleable.MenuItem_icon, 0);
             itemAlphabeticShortcut =
                     getShortcut(a.getString(com.android.internal.R.styleable.MenuItem_alphabeticShortcut));
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index b21af41..b1d509a 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -1551,11 +1551,13 @@
                 Log.e(TAG, "OutOfResourcesException locking surface", e);
                 // TODO: we should ask the window manager to do something!
                 // for now we just do nothing
+                mLayoutRequested = true;    // ask wm for a new surface next time.
                 return;
             } catch (IllegalArgumentException e) {
                 Log.e(TAG, "IllegalArgumentException locking surface", e);
                 // TODO: we should ask the window manager to do something!
                 // for now we just do nothing
+                mLayoutRequested = true;    // ask wm for a new surface next time.
                 return;
             }
 
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 6363299..790a040 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -350,6 +350,7 @@
     private ZoomManager mZoomManager;
 
     private Rect mGLRectViewport = new Rect();
+    private boolean mGLViewportEmpty = false;
 
     /**
      *  Transportation object for returning WebView across thread boundaries.
@@ -3734,6 +3735,10 @@
             return;
         }
 
+        if (canvas.isHardwareAccelerated()) {
+            mZoomManager.setHardwareAccelerated();
+        }
+
         int saveCount = canvas.save();
         if (mInOverScrollMode && !getSettings()
                 .getUseWebViewBackgroundForOverscrollBackground()) {
@@ -4071,7 +4076,8 @@
         }
 
         if (canvas.isHardwareAccelerated()) {
-            int functor = nativeGetDrawGLFunction(mGLRectViewport, getScale(), extras);
+            int functor = nativeGetDrawGLFunction(mGLViewportEmpty ? null : mGLRectViewport,
+                    getScale(), extras);
             ((HardwareCanvas) canvas).callDrawGLFunction(functor);
         } else {
             DrawFilter df = null;
@@ -5155,16 +5161,21 @@
 
     void setGLRectViewport() {
         // Use the getGlobalVisibleRect() to get the intersection among the parents
-        getGlobalVisibleRect(mGLRectViewport);
-
-        // Then need to invert the Y axis, just for GL
-        View rootView = getRootView();
-        int rootViewHeight = rootView.getHeight();
-        int savedWebViewBottom = mGLRectViewport.bottom;
-        mGLRectViewport.bottom = rootViewHeight - mGLRectViewport.top - getVisibleTitleHeight();
-        mGLRectViewport.top = rootViewHeight - savedWebViewBottom;
-
-        nativeUpdateDrawGLFunction(mGLRectViewport);
+        // visible == false means we're clipped - send a null rect down to indicate that
+        // we should not draw
+        boolean visible = getGlobalVisibleRect(mGLRectViewport);
+        if (visible) {
+            // Then need to invert the Y axis, just for GL
+            View rootView = getRootView();
+            int rootViewHeight = rootView.getHeight();
+            int savedWebViewBottom = mGLRectViewport.bottom;
+            mGLRectViewport.bottom = rootViewHeight - mGLRectViewport.top - getVisibleTitleHeight();
+            mGLRectViewport.top = rootViewHeight - savedWebViewBottom;
+            mGLViewportEmpty = false;
+        } else {
+            mGLViewportEmpty = true;
+        }
+        nativeUpdateDrawGLFunction(mGLViewportEmpty ? null : mGLRectViewport);
     }
 
     /**
@@ -6824,7 +6835,7 @@
                     previouslyFocusedRect);
         } else {
             result = super.requestFocus(direction, previouslyFocusedRect);
-            if (mWebViewCore.getSettings().getNeedInitialFocus()) {
+            if (mWebViewCore.getSettings().getNeedInitialFocus() && !isInTouchMode()) {
                 // For cases such as GMail, where we gain focus from a direction,
                 // we want to move to the first available link.
                 // FIXME: If there are no visible links, we may not want to
diff --git a/core/java/android/webkit/ZoomManager.java b/core/java/android/webkit/ZoomManager.java
index b47fe86..efbcd58 100644
--- a/core/java/android/webkit/ZoomManager.java
+++ b/core/java/android/webkit/ZoomManager.java
@@ -183,6 +183,9 @@
     private ScaleGestureDetector mScaleDetector;
     private boolean mPinchToZoomAnimating = false;
 
+    private boolean mHardwareAccelerated = false;
+    private boolean mInHWAcceleratedZoom = false;
+
     public ZoomManager(WebView webView, CallbackProxy callbackProxy) {
         mWebView = webView;
         mCallbackProxy = callbackProxy;
@@ -384,6 +387,10 @@
             scale = getReadingLevelScale();
         }
 
+        if (mHardwareAccelerated) {
+            mInHWAcceleratedZoom = true;
+        }
+
         setZoomScale(scale, reflowText);
 
         if (oldScale != mActualScale) {
@@ -447,8 +454,18 @@
                 - titleHeight, mWebView.getViewHeight(), Math.round(mWebView.getContentHeight()
                 * zoomScale)) + titleHeight) + mWebView.getScrollY();
 
-        canvas.translate(tx, ty);
-        canvas.scale(zoomScale, zoomScale);
+        if (mHardwareAccelerated) {
+            mWebView.updateScrollCoordinates(mWebView.getScrollX() - tx, mWebView.getScrollY() - ty);
+            setZoomScale(zoomScale, false);
+
+            if (mZoomScale == 0) {
+                // We've reached the end of the zoom animation.
+                mInHWAcceleratedZoom = false;
+            }
+        } else {
+            canvas.translate(tx, ty);
+            canvas.scale(zoomScale, zoomScale);
+        }
     }
 
     public boolean isZoomAnimating() {
@@ -493,12 +510,14 @@
             mActualScale = scale;
             mInvActualScale = 1 / scale;
 
-            if (!mWebView.drawHistory()) {
+            if (!mWebView.drawHistory() && !mInHWAcceleratedZoom) {
 
                 // If history Picture is drawn, don't update scroll. They will
                 // be updated when we get out of that mode.
                 // update our scroll so we don't appear to jump
                 // i.e. keep the center of the doc in the center of the view
+                // If this is part of a zoom on a HW accelerated canvas, we
+                // have already updated the scroll so don't do it again.
                 int oldX = mWebView.getScrollX();
                 int oldY = mWebView.getScrollY();
                 float ratio = scale * oldInvScale;
@@ -1020,4 +1039,8 @@
             return null;
         }
     }
+
+    public void setHardwareAccelerated() {
+        mHardwareAccelerated = true;
+    }
 }
diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java
index 7293572..4a34b45 100644
--- a/core/java/android/widget/DatePicker.java
+++ b/core/java/android/widget/DatePicker.java
@@ -30,6 +30,7 @@
 import android.util.Log;
 import android.util.SparseArray;
 import android.view.LayoutInflater;
+import android.view.accessibility.AccessibilityEvent;
 import android.widget.NumberPicker.OnValueChangeListener;
 
 import java.text.ParseException;
@@ -353,6 +354,16 @@
         return mIsEnabled;
     }
 
+    @Override
+    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
+        int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY
+                | DateUtils.FORMAT_SHOW_YEAR;
+        String selectedDateUtterance = DateUtils.formatDateTime(mContext,
+                mCurrentDate.getTimeInMillis(), flags);
+        event.getText().add(selectedDateUtterance);
+        return true;
+    }
+
     /**
      * Gets whether the {@link CalendarView} is shown.
      *
@@ -641,6 +652,7 @@
      * Notifies the listener, if such, for a change in the selected date.
      */
     private void notifyDateChanged() {
+        sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
         if (mOnDateChangedListener != null) {
             mOnDateChangedListener.onDateChanged(this, getYear(), getMonth(), getDayOfMonth());
         }
diff --git a/core/java/android/widget/StackView.java b/core/java/android/widget/StackView.java
index 7a74241..6a09d35 100644
--- a/core/java/android/widget/StackView.java
+++ b/core/java/android/widget/StackView.java
@@ -546,12 +546,16 @@
 
     private void onLayout() {
         if (!mFirstLayoutHappened) {
-            mSlideAmount = Math.round(SLIDE_UP_RATIO * getMeasuredHeight());
-            mSwipeThreshold = Math.round(SWIPE_THRESHOLD_RATIO * mSlideAmount);
             mFirstLayoutHappened = true;
             updateChildTransforms();
         }
 
+        final int newSlideAmount = Math.round(SLIDE_UP_RATIO * getMeasuredHeight());
+        if (mSlideAmount != newSlideAmount) {
+            mSlideAmount = newSlideAmount;
+            mSwipeThreshold = Math.round(SWIPE_THRESHOLD_RATIO * newSlideAmount);
+        }
+
         if (Float.compare(mPerspectiveShiftY, mNewPerspectiveShiftY) != 0 ||
                 Float.compare(mPerspectiveShiftX, mNewPerspectiveShiftX) != 0) {
 
diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java
index 2688b95..4b37beb 100644
--- a/core/java/android/widget/TimePicker.java
+++ b/core/java/android/widget/TimePicker.java
@@ -23,9 +23,11 @@
 import android.content.res.TypedArray;
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.text.format.DateUtils;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.View;
+import android.view.accessibility.AccessibilityEvent;
 import android.widget.NumberPicker.OnValueChangeListener;
 
 import java.text.DateFormatSymbols;
@@ -88,6 +90,8 @@
     // callbacks
     private OnTimeChangedListener mOnTimeChangedListener;
 
+    private Calendar mTempCalendar;
+
     /**
      * The callback interface used to indicate the time has been adjusted.
      */
@@ -214,12 +218,12 @@
         updateAmPmControl();
 
         // initialize to current time
-        Calendar calendar = Calendar.getInstance();
+        mTempCalendar = Calendar.getInstance();
         setOnTimeChangedListener(NO_OP_CHANGE_LISTENER);
 
         // set to current time
-        setCurrentHour(calendar.get(Calendar.HOUR_OF_DAY));
-        setCurrentMinute(calendar.get(Calendar.MINUTE));
+        setCurrentHour(mTempCalendar.get(Calendar.HOUR_OF_DAY));
+        setCurrentMinute(mTempCalendar.get(Calendar.MINUTE));
 
         if (!isEnabled()) {
             setEnabled(false);
@@ -406,6 +410,22 @@
         return mHourSpinner.getBaseline();
     }
 
+    @Override
+    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
+        int flags = DateUtils.FORMAT_SHOW_TIME;
+        if (mIs24HourView) {
+            flags |= DateUtils.FORMAT_24HOUR;
+        } else {
+            flags |= DateUtils.FORMAT_12HOUR;
+        }
+        mTempCalendar.set(Calendar.HOUR_OF_DAY, getCurrentHour());
+        mTempCalendar.set(Calendar.MINUTE, getCurrentMinute());
+        String selectedDateUtterance = DateUtils.formatDateTime(mContext,
+                mTempCalendar.getTimeInMillis(), flags);
+        event.getText().add(selectedDateUtterance);
+        return true;
+    }
+
     private void updateHourControl() {
         if (is24HourView()) {
             mHourSpinner.setMinValue(0);
@@ -435,9 +455,11 @@
                 mAmPmButton.setVisibility(View.VISIBLE);
             }
         }
+        sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
     }
 
     private void onTimeChanged() {
+        sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
         if (mOnTimeChangedListener != null) {
             mOnTimeChangedListener.onTimeChanged(this, getCurrentHour(), getCurrentMinute());
         }
diff --git a/core/res/res/anim/lock_screen_behind_enter.xml b/core/res/res/anim/lock_screen_behind_enter.xml
index c01e265..6c7782e 100644
--- a/core/res/res/anim/lock_screen_behind_enter.xml
+++ b/core/res/res/anim/lock_screen_behind_enter.xml
@@ -3,21 +3,34 @@
 /*
 ** Copyright 2007, 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 
+** 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 
+**     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 
+** 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.
 */
 -->
 
-<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@interpolator/accelerate_cubic">
-    <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
-            android:duration="@android:integer/config_activityDefaultDur" />
-</set>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:detachWallpaper="true" android:shareInterpolator="false">
+    <scale
+        android:fromXScale="0.9" android:toXScale="1.0"
+        android:fromYScale="0.9" android:toYScale="1.0"
+        android:pivotX="50%p" android:pivotY="50%p"
+        android:fillEnabled="true" android:fillBefore="true"
+        android:interpolator="@interpolator/decelerate_cubic"
+        android:startOffset="@android:integer/config_mediumAnimTime"
+        android:duration="@android:integer/config_mediumAnimTime" />
+    <alpha
+        android:fromAlpha="0" android:toAlpha="1.0"
+        android:fillEnabled="true" android:fillBefore="true"
+        android:interpolator="@interpolator/decelerate_quad"
+        android:startOffset="@android:integer/config_mediumAnimTime"
+        android:duration="@android:integer/config_mediumAnimTime"/>
+</set>
\ No newline at end of file
diff --git a/core/res/res/anim/lock_screen_exit.xml b/core/res/res/anim/lock_screen_exit.xml
index 44ca736..d9c3a33 100644
--- a/core/res/res/anim/lock_screen_exit.xml
+++ b/core/res/res/anim/lock_screen_exit.xml
@@ -3,22 +3,33 @@
 /*
 ** Copyright 2007, 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 
+** 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 
+**     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 
+** 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.
 */
 -->
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
-        android:interpolator="@interpolator/decelerate_cubic">
-	<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
-            android:duration="@android:integer/config_activityDefaultDur" />
-</set>
+    android:zAdjustment="top"
+    android:shareInterpolator="false">
+    <scale
+        android:fromXScale="1.0" android:toXScale="1.2"
+        android:fromYScale="1.0" android:toYScale="1.2"
+        android:pivotX="50%p" android:pivotY="50%p"
+        android:fillEnabled="true" android:fillAfter="true"
+        android:interpolator="@interpolator/accelerate_quint"
+        android:duration="@android:integer/config_mediumAnimTime" />
+    <alpha
+        android:fromAlpha="1.0" android:toAlpha="0"
+        android:fillEnabled="true" android:fillAfter="true"
+        android:interpolator="@interpolator/accelerate_quad"
+        android:duration="@android:integer/config_mediumAnimTime"/>
+</set>
\ No newline at end of file
diff --git a/core/res/res/drawable-hdpi/stat_notify_chat.png b/core/res/res/drawable-hdpi/stat_notify_chat.png
index b2e65c6..9c713c8 100644
--- a/core/res/res/drawable-hdpi/stat_notify_chat.png
+++ b/core/res/res/drawable-hdpi/stat_notify_chat.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_tether_bluetooth.png b/core/res/res/drawable-hdpi/stat_sys_tether_bluetooth.png
index e43fbae..11869af 100644
--- a/core/res/res/drawable-hdpi/stat_sys_tether_bluetooth.png
+++ b/core/res/res/drawable-hdpi/stat_sys_tether_bluetooth.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_tether_general.png b/core/res/res/drawable-hdpi/stat_sys_tether_general.png
index c42b00c..f1606ba 100644
--- a/core/res/res/drawable-hdpi/stat_sys_tether_general.png
+++ b/core/res/res/drawable-hdpi/stat_sys_tether_general.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_tether_usb.png b/core/res/res/drawable-hdpi/stat_sys_tether_usb.png
index c6c533d..a05ab3e 100644
--- a/core/res/res/drawable-hdpi/stat_sys_tether_usb.png
+++ b/core/res/res/drawable-hdpi/stat_sys_tether_usb.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_tether_wifi.png b/core/res/res/drawable-hdpi/stat_sys_tether_wifi.png
index 9fcadef..6218c3f 100644
--- a/core/res/res/drawable-hdpi/stat_sys_tether_wifi.png
+++ b/core/res/res/drawable-hdpi/stat_sys_tether_wifi.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_notify_chat.png b/core/res/res/drawable-mdpi/stat_notify_chat.png
index f98b032..91b4290 100644
--- a/core/res/res/drawable-mdpi/stat_notify_chat.png
+++ b/core/res/res/drawable-mdpi/stat_notify_chat.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_sys_tether_bluetooth.png b/core/res/res/drawable-mdpi/stat_sys_tether_bluetooth.png
index efb64ad..b318b9c 100644
--- a/core/res/res/drawable-mdpi/stat_sys_tether_bluetooth.png
+++ b/core/res/res/drawable-mdpi/stat_sys_tether_bluetooth.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_sys_tether_general.png b/core/res/res/drawable-mdpi/stat_sys_tether_general.png
index 3688803..952ff6b 100644
--- a/core/res/res/drawable-mdpi/stat_sys_tether_general.png
+++ b/core/res/res/drawable-mdpi/stat_sys_tether_general.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_sys_tether_usb.png b/core/res/res/drawable-mdpi/stat_sys_tether_usb.png
index 73f1a81..3206557 100644
--- a/core/res/res/drawable-mdpi/stat_sys_tether_usb.png
+++ b/core/res/res/drawable-mdpi/stat_sys_tether_usb.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_sys_tether_wifi.png b/core/res/res/drawable-mdpi/stat_sys_tether_wifi.png
index d448491..45a95f8 100644
--- a/core/res/res/drawable-mdpi/stat_sys_tether_wifi.png
+++ b/core/res/res/drawable-mdpi/stat_sys_tether_wifi.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-hdpi/stat_notify_chat.png b/core/res/res/drawable-xlarge-hdpi/stat_notify_chat.png
index e936fac..8cc5535 100644
--- a/core/res/res/drawable-xlarge-hdpi/stat_notify_chat.png
+++ b/core/res/res/drawable-xlarge-hdpi/stat_notify_chat.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-hdpi/stat_notify_disk_full.png b/core/res/res/drawable-xlarge-hdpi/stat_notify_disk_full.png
index eb626df..4441ba2 100644
--- a/core/res/res/drawable-xlarge-hdpi/stat_notify_disk_full.png
+++ b/core/res/res/drawable-xlarge-hdpi/stat_notify_disk_full.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-hdpi/stat_notify_email_generic.png b/core/res/res/drawable-xlarge-hdpi/stat_notify_email_generic.png
index d6bc7d3..73891a3 100644
--- a/core/res/res/drawable-xlarge-hdpi/stat_notify_email_generic.png
+++ b/core/res/res/drawable-xlarge-hdpi/stat_notify_email_generic.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-hdpi/stat_notify_error.png b/core/res/res/drawable-xlarge-hdpi/stat_notify_error.png
index 8c8f25d..db68eea 100644
--- a/core/res/res/drawable-xlarge-hdpi/stat_notify_error.png
+++ b/core/res/res/drawable-xlarge-hdpi/stat_notify_error.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-hdpi/stat_notify_gmail.png b/core/res/res/drawable-xlarge-hdpi/stat_notify_gmail.png
index 661cc2f..7af6921 100644
--- a/core/res/res/drawable-xlarge-hdpi/stat_notify_gmail.png
+++ b/core/res/res/drawable-xlarge-hdpi/stat_notify_gmail.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/stat_notify_chat.png b/core/res/res/drawable-xlarge-mdpi/stat_notify_chat.png
index b2d7186..22adc67 100644
--- a/core/res/res/drawable-xlarge-mdpi/stat_notify_chat.png
+++ b/core/res/res/drawable-xlarge-mdpi/stat_notify_chat.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/stat_notify_disk_full.png b/core/res/res/drawable-xlarge-mdpi/stat_notify_disk_full.png
index 36ab1ff..c434d12 100644
--- a/core/res/res/drawable-xlarge-mdpi/stat_notify_disk_full.png
+++ b/core/res/res/drawable-xlarge-mdpi/stat_notify_disk_full.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/stat_notify_email_generic.png b/core/res/res/drawable-xlarge-mdpi/stat_notify_email_generic.png
index a14b3c7..daf3b84 100644
--- a/core/res/res/drawable-xlarge-mdpi/stat_notify_email_generic.png
+++ b/core/res/res/drawable-xlarge-mdpi/stat_notify_email_generic.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/stat_notify_error.png b/core/res/res/drawable-xlarge-mdpi/stat_notify_error.png
index 81a66c1..7b097b1 100644
--- a/core/res/res/drawable-xlarge-mdpi/stat_notify_error.png
+++ b/core/res/res/drawable-xlarge-mdpi/stat_notify_error.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/stat_notify_gmail.png b/core/res/res/drawable-xlarge-mdpi/stat_notify_gmail.png
index a286ac6..8daef7c 100644
--- a/core/res/res/drawable-xlarge-mdpi/stat_notify_gmail.png
+++ b/core/res/res/drawable-xlarge-mdpi/stat_notify_gmail.png
Binary files differ
diff --git a/core/res/res/layout/number_picker.xml b/core/res/res/layout/number_picker.xml
index f92c1bc..807daf2 100644
--- a/core/res/res/layout/number_picker.xml
+++ b/core/res/res/layout/number_picker.xml
@@ -22,7 +22,8 @@
     <ImageButton android:id="@+id/increment"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
-        style="?android:attr/numberPickerUpButtonStyle" />
+        style="?android:attr/numberPickerUpButtonStyle"
+        android:contentDescription="@string/number_picker_increment_button" />
 
     <EditText android:id="@+id/numberpicker_input"
         android:layout_width="fill_parent"
@@ -32,6 +33,7 @@
     <ImageButton android:id="@+id/decrement"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
-        style="?android:attr/numberPickerDownButtonStyle" />
+        style="?android:attr/numberPickerDownButtonStyle"
+        android:contentDescription="@string/number_picker_decrement_button" />
 
 </merge>
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index ff9ef59..9c59cb6 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -72,6 +72,9 @@
     <drawable name="editbox_dropdown_dark_frame">@drawable/editbox_dropdown_background_dark</drawable>
     <drawable name="editbox_dropdown_light_frame">@drawable/editbox_dropdown_background</drawable>
 
+    <drawable name="dialog_holo_dark_frame">@drawable/dialog_full_holo_dark</drawable>
+    <drawable name="dialog_holo_light_frame">@drawable/dialog_full_holo_light</drawable>
+    
     <drawable name="input_method_fullscreen_background">#fff9f9f9</drawable>
 
     <!-- For date picker widget -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index ae269df..957707d 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1496,6 +1496,9 @@
        a ListView). -->
   <public type="layout" name="simple_list_item_activated_2" />
 
+  <public type="drawable" name="dialog_holo_dark_frame" />
+  <public type="drawable" name="dialog_holo_light_frame" />
+
   <public type="style" name="Theme.WithActionBar" />
   <public type="style" name="Theme.NoTitleBar.OverlayActionModes" />
 
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 529111e..d09210e 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2690,4 +2690,11 @@
 
     <!-- Choose Account Activity label -->
     <string name="choose_account_label">Select an account</string>
+
+    <!-- NumberPicker - accessibility support -->
+    <!-- Description of the button to increment the NumberPicker value. [CHAR LIMIT=NONE] -->
+    <string name="number_picker_increment_button">Increment</string>
+    <!-- Description of the button to decrement the NumberPicker value. [CHAR LIMIT=NONE] -->
+    <string name="number_picker_decrement_button">Decrement</string>
+
 </resources>
diff --git a/data/etc/android.hardware.touchscreen.multitouch.distinct.xml b/data/etc/android.hardware.touchscreen.multitouch.distinct.xml
index a3c116a..35eeefd 100644
--- a/data/etc/android.hardware.touchscreen.multitouch.distinct.xml
+++ b/data/etc/android.hardware.touchscreen.multitouch.distinct.xml
@@ -20,4 +20,5 @@
     <feature name="android.hardware.touchscreen" />
     <feature name="android.hardware.touchscreen.multitouch" />
     <feature name="android.hardware.touchscreen.multitouch.distinct" />
+    <feature name="android.hardware.faketouch" />
 </permissions>
diff --git a/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml b/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml
index 80bf859..ed6606d 100644
--- a/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml
+++ b/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml
@@ -21,4 +21,5 @@
     <feature name="android.hardware.touchscreen.multitouch" />
     <feature name="android.hardware.touchscreen.multitouch.distinct" />
     <feature name="android.hardware.touchscreen.multitouch.jazzhand" />
+    <feature name="android.hardware.faketouch" />
 </permissions>
diff --git a/data/etc/android.hardware.touchscreen.multitouch.xml b/data/etc/android.hardware.touchscreen.multitouch.xml
index 34b518a..1d59a27 100644
--- a/data/etc/android.hardware.touchscreen.multitouch.xml
+++ b/data/etc/android.hardware.touchscreen.multitouch.xml
@@ -20,4 +20,5 @@
 <permissions>
     <feature name="android.hardware.touchscreen" />
     <feature name="android.hardware.touchscreen.multitouch" />
+    <feature name="android.hardware.faketouch" />
 </permissions>
diff --git a/data/etc/android.hardware.touchscreen.xml b/data/etc/android.hardware.touchscreen.xml
index 10c91f1..5b5ddf9 100644
--- a/data/etc/android.hardware.touchscreen.xml
+++ b/data/etc/android.hardware.touchscreen.xml
@@ -18,4 +18,5 @@
      support multitouch. -->
 <permissions>
     <feature name="android.hardware.touchscreen" />
+    <feature name="android.hardware.faketouch" />
 </permissions>
diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java
index 64c209a..4c659d4 100644
--- a/graphics/java/android/graphics/SurfaceTexture.java
+++ b/graphics/java/android/graphics/SurfaceTexture.java
@@ -24,9 +24,9 @@
 /**
  * Captures frames from an image stream as an OpenGL ES texture.
  *
- * <p>The image stream may come from either video playback or camera preview.  A SurfaceTexture may
- * be used in place of a SurfaceHolder when specifying the output destination of a MediaPlayer or
- * Camera object.  This will cause all the frames from that image stream to be sent to the
+ * <p>The image stream may come from either camera preview.  A SurfaceTexture may be used in place
+ * of a SurfaceHolder when specifying the output destination of a {@link android.hardware.Camera}
+ * object.  Doing so will cause all the frames from the image stream to be sent to the
  * SurfaceTexture object rather than to the device's display.  When {@link #updateTexImage} is
  * called, the contents of the texture object specified when the SurfaceTexture was created is
  * updated to contain the most recent image from the image stream.  This may cause some frames of
@@ -34,6 +34,11 @@
  *
  * <p>The texture object uses the GL_TEXTURE_EXTERNAL_OES texture target, which is defined by the
  * OES_EGL_image_external OpenGL ES extension.  This limits how the texture may be used.
+ *
+ * <p>SurfaceTexture objects may be created on any thread.  {@link #updateTexImage} may only be
+ * called on the thread with the OpenGL ES context that contains the texture object.  The
+ * frame-available callback is called on an arbitrary thread, so unless special care is taken {@link
+ * #updateTexImage} should not be called directly from the callback.
  */
 public class SurfaceTexture {
 
diff --git a/libs/hwui/OpenGLDebugRenderer.cpp b/libs/hwui/OpenGLDebugRenderer.cpp
index 58d6c26..05870bb 100644
--- a/libs/hwui/OpenGLDebugRenderer.cpp
+++ b/libs/hwui/OpenGLDebugRenderer.cpp
@@ -23,10 +23,11 @@
 namespace android {
 namespace uirenderer {
 
-void OpenGLDebugRenderer::prepare(bool opaque) {
+void OpenGLDebugRenderer::prepareDirty(float left, float top,
+        float right, float bottom, bool opaque) {
     mPrimitivesCount = 0;
     LOGD("========= Frame start =========");
-    OpenGLRenderer::prepare(opaque);
+    OpenGLRenderer::prepareDirty(left, top, right, bottom, opaque);
 }
 
 void OpenGLDebugRenderer::finish() {
@@ -105,6 +106,33 @@
     OpenGLRenderer::drawRect(left, top, right, bottom, paint);
 }
 
+void OpenGLDebugRenderer::drawRoundRect(float left, float top, float right, float bottom,
+        float rx, float ry, SkPaint* paint) {
+    mPrimitivesCount++;
+    StopWatch w("drawRoundRect");
+    OpenGLRenderer::drawRoundRect(left, top, right, bottom, rx, ry, paint);
+}
+
+void OpenGLDebugRenderer::drawCircle(float x, float y, float radius, SkPaint* paint) {
+    mPrimitivesCount++;
+    StopWatch w("drawCircle");
+    OpenGLRenderer::drawCircle(x, y, radius, paint);
+}
+
+void OpenGLDebugRenderer::drawOval(float left, float top, float right, float bottom,
+        SkPaint* paint) {
+    mPrimitivesCount++;
+    StopWatch w("drawOval");
+    OpenGLRenderer::drawOval(left, top, right, bottom, paint);
+}
+
+void OpenGLDebugRenderer::drawArc(float left, float top, float right, float bottom,
+        float startAngle, float sweepAngle, bool useCenter, SkPaint* paint) {
+    mPrimitivesCount++;
+    StopWatch w("drawArc");
+    OpenGLRenderer::drawArc(left, top, right, bottom, startAngle, sweepAngle, useCenter, paint);
+}
+
 void OpenGLDebugRenderer::drawPath(SkPath* path, SkPaint* paint) {
     mPrimitivesCount++;
     StopWatch w("drawPath");
diff --git a/libs/hwui/OpenGLDebugRenderer.h b/libs/hwui/OpenGLDebugRenderer.h
index 76e6a2e..1a18a67 100644
--- a/libs/hwui/OpenGLDebugRenderer.h
+++ b/libs/hwui/OpenGLDebugRenderer.h
@@ -34,7 +34,7 @@
     ~OpenGLDebugRenderer() {
     }
 
-    void prepare(bool opaque);
+    void prepareDirty(float left, float top, float right, float bottom, bool opaque);
     void finish();
 
     int saveLayer(float left, float top, float right, float bottom,
@@ -52,6 +52,12 @@
             float left, float top, float right, float bottom, SkPaint* paint);
     void drawColor(int color, SkXfermode::Mode mode);
     void drawRect(float left, float top, float right, float bottom, SkPaint* paint);
+    void drawRoundRect(float left, float top, float right, float bottom,
+            float rx, float ry, SkPaint* paint);
+    void drawCircle(float x, float y, float radius, SkPaint* paint);
+    void drawOval(float left, float top, float right, float bottom, SkPaint* paint);
+    void drawArc(float left, float top, float right, float bottom,
+            float startAngle, float sweepAngle, bool useCenter, SkPaint* paint);
     void drawPath(SkPath* path, SkPaint* paint);
     void drawLines(float* points, int count, SkPaint* paint);
     void drawText(const char* text, int bytesCount, int count, float x, float y,
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 40cb5c7..1dfedb3 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -528,6 +528,7 @@
 
 void Context::destroyWorkerThreadResources() {
     //LOGV("destroyWorkerThreadResources 1");
+    ObjectBase::zeroAllUserRef(this);
     if (mIsGraphicsContext) {
          mRaster.clear();
          mFragment.clear();
@@ -542,7 +543,6 @@
          mStateFont.deinit(this);
          mShaderCache.cleanupAll();
     }
-    ObjectBase::zeroAllUserRef(this);
     //LOGV("destroyWorkerThreadResources 2");
     mExit = true;
 }
diff --git a/libs/rs/rsFont.cpp b/libs/rs/rsFont.cpp
index 8571c32..7fdfbe0 100644
--- a/libs/rs/rsFont.cpp
+++ b/libs/rs/rsFont.cpp
@@ -74,6 +74,15 @@
     return true;
 }
 
+void Font::preDestroy() const {
+    for (uint32_t ct = 0; ct < mRSC->mStateFont.mActiveFonts.size(); ct++) {
+        if (mRSC->mStateFont.mActiveFonts[ct] == this) {
+            mRSC->mStateFont.mActiveFonts.removeAt(ct);
+            break;
+        }
+    }
+}
+
 void Font::invalidateTextureCache() {
     for (uint32_t i = 0; i < mCachedGlyphs.size(); i ++) {
         mCachedGlyphs.valueAt(i)->mIsValid = false;
@@ -309,13 +318,6 @@
         FT_Done_Face(mFace);
     }
 
-    for (uint32_t ct = 0; ct < mRSC->mStateFont.mActiveFonts.size(); ct++) {
-        if (mRSC->mStateFont.mActiveFonts[ct] == this) {
-            mRSC->mStateFont.mActiveFonts.removeAt(ct);
-            break;
-        }
-    }
-
     for (uint32_t i = 0; i < mCachedGlyphs.size(); i ++) {
         CachedGlyphInfo *glyph = mCachedGlyphs.valueAt(i);
         delete glyph;
@@ -799,11 +801,6 @@
 
     mDefault.clear();
 
-    Vector<Font*> fontsToDereference = mActiveFonts;
-    for (uint32_t i = 0; i < fontsToDereference.size(); i ++) {
-        fontsToDereference[i]->zeroUserRef();
-    }
-
     if (mLibrary) {
         FT_Done_FreeType( mLibrary );
         mLibrary = NULL;
diff --git a/libs/rs/rsFont.h b/libs/rs/rsFont.h
index 00d77c8..4820999 100644
--- a/libs/rs/rsFont.h
+++ b/libs/rs/rsFont.h
@@ -119,6 +119,7 @@
     Font(Context *rsc);
     bool init(const char *name, float fontSize, uint32_t dpi, const void *data = NULL, uint32_t dataLen = 0);
 
+    virtual void preDestroy() const;
     FT_Face mFace;
     bool mInitialized;
     bool mHasKerning;
diff --git a/libs/rs/rsLocklessFifo.cpp b/libs/rs/rsLocklessFifo.cpp
index 3f88543..70b7278 100644
--- a/libs/rs/rsLocklessFifo.cpp
+++ b/libs/rs/rsLocklessFifo.cpp
@@ -100,7 +100,9 @@
     //dumpState("commit 1");
     reinterpret_cast<uint16_t *>(mPut)[0] = command;
     reinterpret_cast<uint16_t *>(mPut)[1] = sizeInBytes;
-    mPut += ((sizeInBytes + 3) & ~3) + 4;
+
+    int32_t s = ((sizeInBytes + 3) & ~3) + 4;
+    android_atomic_add(s, (int32_t *)&mPut);
     //dumpState("commit 2");
     mSignalToWorker.set();
 }
diff --git a/libs/rs/rsScript.cpp b/libs/rs/rsScript.cpp
index efdc626..9ada9c2 100644
--- a/libs/rs/rsScript.cpp
+++ b/libs/rs/rsScript.cpp
@@ -78,8 +78,6 @@
             (*destPtr)->decSysRef();
         }
         *destPtr = val;
-    } else {
-        LOGV("Calling setVarObj on slot = %i which is null.  This is dangerous because the script will not hold a ref count on the object.", slot);
     }
 }
 
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index 3858e1c..fc673a2 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -94,16 +94,24 @@
 }
 
 ScriptC::ScriptC(Context *rsc) : Script(rsc) {
-    LOGD(">>>> ScriptC ctor called, obj=%p", this);
     mBccScript = NULL;
     memset(&mProgram, 0, sizeof(mProgram));
 }
 
 ScriptC::~ScriptC() {
-    LOGD(">>>> ~ScriptC() mBccScript = %p", mBccScript);
     if (mBccScript) {
+        if (mProgram.mObjectSlotList) {
+            for (size_t ct=0; ct < mProgram.mObjectSlotCount; ct++) {
+                setVarObj(mProgram.mObjectSlotList[ct], NULL);
+            }
+            delete [] mProgram.mObjectSlotList;
+            mProgram.mObjectSlotList = NULL;
+            mProgram.mObjectSlotCount = 0;
+        }
+
+
+        LOGD(">>>> ~ScriptC  bccDisposeScript(%p)", mBccScript);
         bccDisposeScript(mBccScript);
-        LOGD(">>>> ~ScriptC(mBCCScript)");
     }
     free(mEnviroment.mScriptText);
     mEnviroment.mScriptText = NULL;
@@ -589,6 +597,16 @@
             return false;
         }
     }
+
+    size_t objectSlotCount = bccGetObjectSlotCount(s->mBccScript);
+    uint32_t *objectSlots = NULL;
+    if (objectSlotCount) {
+        objectSlots = new uint32_t[objectSlotCount];
+        bccGetObjectSlotList(s->mBccScript, objectSlotCount, objectSlots);
+        s->mProgram.mObjectSlotList = objectSlots;
+        s->mProgram.mObjectSlotCount = objectSlotCount;
+    }
+
     return true;
 }
 
diff --git a/libs/rs/rsScriptC.h b/libs/rs/rsScriptC.h
index 7143c67..e794feb 100644
--- a/libs/rs/rsScriptC.h
+++ b/libs/rs/rsScriptC.h
@@ -42,8 +42,12 @@
 
         RunScript_t mRoot;
         VoidFunc_t mInit;
+
+        uint32_t * mObjectSlotList;
+        uint32_t mObjectSlotCount;
     };
 
+
     Program_t mProgram;
 
     BCCScriptRef mBccScript;
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp
index bbf5093..73ff230 100644
--- a/libs/utils/ResourceTypes.cpp
+++ b/libs/utils/ResourceTypes.cpp
@@ -3703,9 +3703,9 @@
 void ResTable::getLocales(Vector<String8>* locales) const
 {
     Vector<ResTable_config> configs;
-    LOGD("calling getConfigurations");
+    LOGV("calling getConfigurations");
     getConfigurations(&configs);
-    LOGD("called getConfigurations size=%d", (int)configs.size());
+    LOGV("called getConfigurations size=%d", (int)configs.size());
     const size_t I = configs.size();
     for (size_t i=0; i<I; i++) {
         char locale[6];
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 7312d75..cbc7529 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -1450,7 +1450,7 @@
         if (AudioSystem.getForceUse(AudioSystem.FOR_COMMUNICATION) == AudioSystem.FORCE_BT_SCO) {
             // Log.v(TAG, "getActiveStreamType: Forcing STREAM_BLUETOOTH_SCO...");
             return AudioSystem.STREAM_BLUETOOTH_SCO;
-        } else if (isOffhook || AudioSystem.isStreamActive(AudioSystem.STREAM_VOICE_CALL)) {
+        } else if (isOffhook || getMode() == AudioManager.MODE_IN_COMMUNICATION) {
             // Log.v(TAG, "getActiveStreamType: Forcing STREAM_VOICE_CALL...");
             return AudioSystem.STREAM_VOICE_CALL;
         } else if (AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC)) {
diff --git a/media/libstagefright/rtsp/ASessionDescription.cpp b/media/libstagefright/rtsp/ASessionDescription.cpp
index 77917b3..3e710dc 100644
--- a/media/libstagefright/rtsp/ASessionDescription.cpp
+++ b/media/libstagefright/rtsp/ASessionDescription.cpp
@@ -254,26 +254,12 @@
         return false;
     }
 
-    if (value == "npt=now-" || value == "npt=0-") {
-        return false;
-    }
-
     if (strncmp(value.c_str(), "npt=", 4)) {
         return false;
     }
 
-    const char *s = value.c_str() + 4;
-    char *end;
-    double from = strtod(s, &end);
-
-    if (end == s || *end != '-') {
-        return false;
-    }
-
-    s = end + 1;
-    double to = strtod(s, &end);
-
-    if (end == s || *end != '\0' || to < from) {
+    float from, to;
+    if (!parseNTPRange(value.c_str() + 4, &from, &to)) {
         return false;
     }
 
@@ -307,5 +293,39 @@
     }
 }
 
+// static
+bool ASessionDescription::parseNTPRange(
+        const char *s, float *npt1, float *npt2) {
+    if (s[0] == '-') {
+        return false;  // no start time available.
+    }
+
+    if (!strncmp("now", s, 3)) {
+        return false;  // no absolute start time available
+    }
+
+    char *end;
+    *npt1 = strtof(s, &end);
+
+    if (end == s || *end != '-') {
+        // Failed to parse float or trailing "dash".
+        return false;
+    }
+
+    s = end + 1;  // skip the dash.
+
+    if (!strncmp("now", s, 3)) {
+        return false;  // no absolute end time available
+    }
+
+    *npt2 = strtof(s, &end);
+
+    if (end == s || *end != '\0') {
+        return false;
+    }
+
+    return *npt2 > *npt1;
+}
+
 }  // namespace android
 
diff --git a/media/libstagefright/rtsp/ASessionDescription.h b/media/libstagefright/rtsp/ASessionDescription.h
index a3fa79e..b462983 100644
--- a/media/libstagefright/rtsp/ASessionDescription.h
+++ b/media/libstagefright/rtsp/ASessionDescription.h
@@ -55,6 +55,14 @@
 
     bool findAttribute(size_t index, const char *key, AString *value) const;
 
+    // parses strings of the form
+    //   npt      := npt-time "-" npt-time? | "-" npt-time
+    //   npt-time := "now" | [0-9]+("." [0-9]*)?
+    //
+    // Returns true iff both "npt1" and "npt2" times were available,
+    // i.e. we have a fixed duration, otherwise this is live streaming.
+    static bool parseNTPRange(const char *s, float *npt1, float *npt2);
+
 protected:
     virtual ~ASessionDescription();
 
diff --git a/media/libstagefright/rtsp/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h
index 9bb8c46..306a9c1 100644
--- a/media/libstagefright/rtsp/MyHandler.h
+++ b/media/libstagefright/rtsp/MyHandler.h
@@ -938,13 +938,11 @@
 
         AString val;
         CHECK(GetAttribute(range.c_str(), "npt", &val));
-        float npt1, npt2;
 
-        if (val == "now-" || val == "0-") {
+        float npt1, npt2;
+        if (!ASessionDescription::parseNTPRange(val.c_str(), &npt1, &npt2)) {
             // This is a live stream and therefore not seekable.
             return;
-        } else {
-            CHECK_EQ(sscanf(val.c_str(), "%f-%f", &npt1, &npt2), 2);
         }
 
         i = response->mHeaders.indexOfKey("rtp-info");
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_gps_acquiring.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_gps_acquiring.png
index 150c9fc..61f65bf 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_gps_acquiring.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_gps_acquiring.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_0.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_0.png
index ecb3951..ff74c35 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_0.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_0.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_1.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_1.png
index e375a8a..6375b1b 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_1.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_1.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_1_fully.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_1_fully.png
index 13dde32a..ef886b8 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_1_fully.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_1_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_2.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_2.png
index 24ade2c..92882bd 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_2.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_2.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_2_fully.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_2_fully.png
index efa6f79..cf5c4c3 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_2_fully.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_2_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_3.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_3.png
index 5b5baed..24b6d25 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_3.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_3.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_3_fully.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_3_fully.png
index 2eaff98..b147583 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_3_fully.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_3_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_4.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_4.png
index b515cf0..594ad6a 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_4.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_4.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_4_fully.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_4_fully.png
index d8599b5..2879550 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_4_fully.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_4_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_0.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_0.png
index 1b404b3..7cd2893 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_0.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_0.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_1.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_1.png
index ba9cc9c..23eb1d6 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_1.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_1.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_1_fully.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_1_fully.png
index 3e29d5e..ad28667 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_1_fully.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_1_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_2.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_2.png
index e1900ea..048dfd1 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_2.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_2.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_2_fully.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_2_fully.png
index 2b00f3b..224ae1f 100755
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_2_fully.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_2_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_3.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_3.png
index 6158e66..b85859b 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_3.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_3.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_3_fully.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_3_fully.png
index b183160..d7f3960 100755
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_3_fully.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_3_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_4.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_4.png
index 1b96f39..54915b9 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_4.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_4.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_4_fully.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_4_fully.png
index cf504f5..bd44b52 100755
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_4_fully.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_signal_4_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_gps_acquiring.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_gps_acquiring.png
index e5e98f9..3a0fce0 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_gps_acquiring.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_gps_acquiring.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_0.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_0.png
index cf11f0d..8654aa0 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_0.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_0.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_1.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_1.png
index 3b69d1e..c10629f 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_1.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_1.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_1_fully.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_1_fully.png
index b012b18..753c9f9 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_1_fully.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_1_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_2.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_2.png
index 8736234..65a886a 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_2.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_2.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_2_fully.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_2_fully.png
index cc68512..6e90ce4 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_2_fully.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_2_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_3.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_3.png
index 5a2d3c0..cce7d9b 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_3.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_3.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_3_fully.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_3_fully.png
index a93d49c..c4e33bd 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_3_fully.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_3_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_4.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_4.png
index 3fbf7fc..433a2c5 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_4.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_4.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_4_fully.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_4_fully.png
index e3ff8b9..81401b2 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_4_fully.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_4_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_0.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_0.png
index b11ad16..75906a2 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_0.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_0.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_1.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_1.png
index 94d40e0..528e4ce 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_1.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_1.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_1_fully.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_1_fully.png
index 4a896f3..1eb5aad 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_1_fully.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_1_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_2.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_2.png
index b09b40d..5f2c230 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_2.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_2.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_2_fully.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_2_fully.png
index 0f9c187..2c27620 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_2_fully.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_2_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_3.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_3.png
index b852dba..4cb06be 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_3.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_3.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_3_fully.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_3_fully.png
index 0468d06..fd9c350 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_3_fully.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_3_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_4.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_4.png
index 06bbb4a..e8aed95 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_4.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_4.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_4_fully.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_4_fully.png
index 1858af3..c629387 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_4_fully.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_signal_4_fully.png
Binary files differ
diff --git a/packages/SystemUI/res/layout-xlarge/status_bar_notification_area.xml b/packages/SystemUI/res/layout-xlarge/status_bar_notification_area.xml
index 2ee2ac4..0925f77 100644
--- a/packages/SystemUI/res/layout-xlarge/status_bar_notification_area.xml
+++ b/packages/SystemUI/res/layout-xlarge/status_bar_notification_area.xml
@@ -45,7 +45,6 @@
             android:id="@+id/notificationIcons"
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
-            android:orientation="horizontal"
             >
             <view
                 class="com.android.systemui.statusbar.tablet.NotificationIconArea$IconLayout"
@@ -55,6 +54,14 @@
                 android:layout_gravity="center_vertical"
                 android:layout_marginLeft="8dp"
                 />
+            <View 
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_alignLeft="@id/icons"
+                android:layout_alignRight="@id/icons"
+                android:background="@drawable/notification_icon_area_smoke"
+                android:clickable="false"
+                />
         </com.android.systemui.statusbar.tablet.NotificationIconArea>
     </LinearLayout>
 
diff --git a/packages/SystemUI/res/values-xlarge/colors.xml b/packages/SystemUI/res/values-xlarge/colors.xml
index 14161c3..43af2c7 100644
--- a/packages/SystemUI/res/values-xlarge/colors.xml
+++ b/packages/SystemUI/res/values-xlarge/colors.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <drawable name="status_bar_background">#000000</drawable>
+    <drawable name="notification_icon_area_smoke">#A0000000</drawable>
 </resources>
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java
index a1cc274..474ef45 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java
@@ -75,6 +75,7 @@
     private LinearLayout mInputMethodMenuList;
     private PackageManager mPackageManager;
     private String mEnabledInputMethodAndSubtypesCacheStr;
+    private String mLastSystemLocaleString;
     private View mConfigureImeShortcut;
 
     private class InputMethodComparator implements Comparator<InputMethodInfo> {
@@ -335,8 +336,10 @@
             getEnabledInputMethodAndSubtypeList() {
         String newEnabledIMIs = Settings.Secure.getString(
                 mContext.getContentResolver(), Settings.Secure.ENABLED_INPUT_METHODS);
-        if (mEnabledInputMethodAndSubtypesCacheStr == null
-                || !mEnabledInputMethodAndSubtypesCacheStr.equals(newEnabledIMIs)
+        String currentSystemLocaleString =
+                mContext.getResources().getConfiguration().locale.toString();
+        if (!TextUtils.equals(mEnabledInputMethodAndSubtypesCacheStr, newEnabledIMIs)
+                || !TextUtils.equals(mLastSystemLocaleString, currentSystemLocaleString)
                 || mPackageChanged) {
             mEnabledInputMethodAndSubtypesCache.clear();
             final List<InputMethodInfo> imis = mImm.getEnabledInputMethodList();
@@ -346,6 +349,7 @@
             }
             mEnabledInputMethodAndSubtypesCacheStr = newEnabledIMIs;
             mPackageChanged = false;
+            mLastSystemLocaleString = currentSystemLocaleString;
         }
         return mEnabledInputMethodAndSubtypesCache;
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationIconArea.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationIconArea.java
index df29f95..3d6c1a2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationIconArea.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationIconArea.java
@@ -23,13 +23,14 @@
 import android.util.Slog;
 import android.view.View;
 import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
 import android.widget.ImageView;
 import android.view.MotionEvent;
 
 import com.android.systemui.R;
 
 
-public class NotificationIconArea extends LinearLayout {
+public class NotificationIconArea extends RelativeLayout {
     private static final String TAG = "NotificationIconArea";
 
     IconLayout mIconLayout;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java
index 5184462..a072aed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java
@@ -53,7 +53,7 @@
 
     private static final String TAG = "StatusBar.TabletTicker";
 
-    private static final boolean CLICKABLE_TICKER = false;
+    private static final boolean CLICKABLE_TICKER = true;
 
     // 3 is enough to let us see most cases, but not get so far behind that it's too annoying.
     private static final int QUEUE_LENGTH = 3;
@@ -300,8 +300,16 @@
         if (CLICKABLE_TICKER) {
             PendingIntent contentIntent = notification.notification.contentIntent;
             if (contentIntent != null) {
-                group.setOnClickListener(mBar.makeClicker(contentIntent,
-                            notification.pkg, notification.tag, notification.id));
+                // create the usual notification clicker, but chain it together with a halt() call
+                // to abort the ticker too
+                final View.OnClickListener clicker = mBar.makeClicker(contentIntent,
+                                            notification.pkg, notification.tag, notification.id);
+                group.setOnClickListener(new View.OnClickListener() {
+                    public void onClick(View v) {
+                        halt();
+                        clicker.onClick(v);
+                    }
+                });
             } else {
                 group.setOnClickListener(null);
             }
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 30a9432..fcc8e693 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -1315,7 +1315,20 @@
     static boolean canBeImeTarget(WindowState w) {
         final int fl = w.mAttrs.flags
                 & (FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM);
-        if (fl == 0 || fl == (FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
+        if (fl == 0 || fl == (FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)
+                || w.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING) {
+            if (DEBUG_INPUT_METHOD) {
+                Slog.i(TAG, "isVisibleOrAdding " + w + ": " + w.isVisibleOrAdding());
+                if (!w.isVisibleOrAdding()) {
+                    Slog.i(TAG, "  mSurface=" + w.mSurface + " reportDestroy=" + w.mReportDestroySurface
+                            + " relayoutCalled=" + w.mRelayoutCalled + " viewVis=" + w.mViewVisibility
+                            + " policyVis=" + w.mPolicyVisibility + " attachHid=" + w.mAttachedHidden
+                            + " exiting=" + w.mExiting + " destroying=" + w.mDestroying);
+                    if (w.mAppToken != null) {
+                        Slog.i(TAG, "  mAppToken.hiddenRequested=" + w.mAppToken.hiddenRequested);
+                    }
+                }
+            }
             return w.isVisibleOrAdding();
         }
         return false;
@@ -1330,8 +1343,8 @@
             i--;
             w = localmWindows.get(i);
 
-            //Slog.i(TAG, "Checking window @" + i + " " + w + " fl=0x"
-            //        + Integer.toHexString(w.mAttrs.flags));
+            if (DEBUG_INPUT_METHOD && willMove) Slog.i(TAG, "Checking window @" + i
+                    + " " + w + " fl=0x" + Integer.toHexString(w.mAttrs.flags));
             if (canBeImeTarget(w)) {
                 //Slog.i(TAG, "Putting input method here!");
 
@@ -1353,6 +1366,8 @@
             }
         }
 
+        if (DEBUG_INPUT_METHOD && willMove) Slog.v(TAG, "Proposed new IME target: " + w);
+        
         // Now, a special case -- if the last target's window is in the
         // process of exiting, and is above the new target, keep on the
         // last target to avoid flicker.  Consider for example a Dialog with
@@ -1365,6 +1380,7 @@
             if (mInputMethodTarget.mAnimLayer > w.mAnimLayer) {
                 w = mInputMethodTarget;
                 i = localmWindows.indexOf(w);
+                if (DEBUG_INPUT_METHOD) Slog.v(TAG, "Current target higher, switching to: " + w);
             }
         }
 
@@ -1420,6 +1436,7 @@
                         // with an animation, and it is on top of the next target
                         // we will be over, then hold off on moving until
                         // that is done.
+                        mInputMethodTargetWaitingAnim = true;
                         mInputMethodTarget = highestTarget;
                         return highestPos + 1;
                     }
@@ -1440,6 +1457,7 @@
                             + mInputMethodTarget + " to " + w, e);
                 }
                 mInputMethodTarget = w;
+                mInputMethodTargetWaitingAnim = false;
                 if (w.mAppToken != null) {
                     setInputMethodAnimLayerAdjustment(w.mAppToken.animLayerAdjustment);
                 } else {
@@ -8539,7 +8557,7 @@
                 w.mAnimLayer = w.mLayer + adj;
                 if (DEBUG_LAYERS) Slog.v(TAG, "Updating layer " + w + ": "
                         + w.mAnimLayer);
-                if (w == mInputMethodTarget) {
+                if (w == mInputMethodTarget && !mInputMethodTargetWaitingAnim) {
                     setInputMethodAnimLayerAdjustment(adj);
                 }
                 if (w == mWallpaperTarget && mLowerWallpaperTarget == null) {
@@ -8630,6 +8648,10 @@
 
             clearAnimation();
             animating = false;
+            if (animLayerAdjustment != 0) {
+                animLayerAdjustment = 0;
+                updateLayers();
+            }
             if (mInputMethodTarget != null && mInputMethodTarget.mAppToken == this) {
                 moveInputMethodWindowsIfNeededLocked(true);
             }
@@ -8639,10 +8661,6 @@
                     + ": reportedVisible=" + reportedVisible);
 
             transformation.clear();
-            if (animLayerAdjustment != 0) {
-                animLayerAdjustment = 0;
-                updateLayers();
-            }
 
             final int N = windows.size();
             for (int i=0; i<N; i++) {
@@ -9248,11 +9266,47 @@
             WindowState imFocus;
             if (idx > 0) {
                 imFocus = mWindows.get(idx-1);
+                //Log.i(TAG, "Desired input method target: " + imFocus);
+                //Log.i(TAG, "Current focus: " + this.mCurrentFocus);
+                //Log.i(TAG, "Last focus: " + this.mLastFocus);
                 if (imFocus != null) {
+                    // This may be a starting window, in which case we still want
+                    // to count it as okay.
+                    if (imFocus.mAttrs.type == LayoutParams.TYPE_APPLICATION_STARTING
+                            && imFocus.mAppToken != null) {
+                        // The client has definitely started, so it really should
+                        // have a window in this app token.  Let's look for it.
+                        for (int i=0; i<imFocus.mAppToken.windows.size(); i++) {
+                            WindowState w = imFocus.mAppToken.windows.get(i);
+                            if (w != imFocus) {
+                                //Log.i(TAG, "Switching to real app window: " + w);
+                                imFocus = w;
+                                break;
+                            }
+                        }
+                    }
+                    //Log.i(TAG, "IM target client: " + imFocus.mSession.mClient);
+                    //if (imFocus.mSession.mClient != null) {
+                    //    Log.i(TAG, "IM target client binder: " + imFocus.mSession.mClient.asBinder());
+                    //    Log.i(TAG, "Requesting client binder: " + client.asBinder());
+                    //}
                     if (imFocus.mSession.mClient != null &&
                             imFocus.mSession.mClient.asBinder() == client.asBinder()) {
                         return true;
                     }
+                    
+                    // Okay, how about this...  what is the current focus?
+                    // It seems in some cases we may not have moved the IM
+                    // target window, such as when it was in a pop-up window,
+                    // so let's also look at the current focus.  (An example:
+                    // go to Gmail, start searching so the keyboard goes up,
+                    // press home.  Sometimes the IME won't go down.)
+                    // Would be nice to fix this more correctly, but it's
+                    // way at the end of a release, and this should be good enough.
+                    if (mCurrentFocus != null && mCurrentFocus.mSession.mClient != null &&
+                            mCurrentFocus.mSession.mClient.asBinder() == client.asBinder()) {
+                        return true;
+                    }
                 }
             }
         }
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 6bb19b0..254a19b 100755
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -11944,28 +11944,6 @@
             adj = FOREGROUND_APP_ADJ;
             schedGroup = Process.THREAD_GROUP_DEFAULT;
             app.adjType = "exec-service";
-        } else if (app.foregroundServices) {
-            // The user is aware of this app, so make it visible.
-            adj = PERCEPTIBLE_APP_ADJ;
-            schedGroup = Process.THREAD_GROUP_DEFAULT;
-            app.adjType = "foreground-service";
-        } else if (app.forcingToForeground != null) {
-            // The user is aware of this app, so make it visible.
-            adj = PERCEPTIBLE_APP_ADJ;
-            schedGroup = Process.THREAD_GROUP_DEFAULT;
-            app.adjType = "force-foreground";
-            app.adjSource = app.forcingToForeground;
-        } else if (app == mHeavyWeightProcess) {
-            // We don't want to kill the current heavy-weight process.
-            adj = HEAVY_WEIGHT_APP_ADJ;
-            schedGroup = Process.THREAD_GROUP_BG_NONINTERACTIVE;
-            app.adjType = "heavy";
-        } else if (app == mHomeProcess) {
-            // This process is hosting what we currently consider to be the
-            // home app, so we don't want to let it go into the background.
-            adj = HOME_APP_ADJ;
-            schedGroup = Process.THREAD_GROUP_BG_NONINTERACTIVE;
-            app.adjType = "home";
         } else if ((N=app.activities.size()) != 0) {
             // This app is in the background with paused activities.
             app.hidden = true;
@@ -11998,7 +11976,37 @@
             adj = hiddenAdj;
             app.adjType = "bg-empty";
         }
+        
+        if (adj > PERCEPTIBLE_APP_ADJ) {
+            if (app.foregroundServices) {
+                // The user is aware of this app, so make it visible.
+                adj = PERCEPTIBLE_APP_ADJ;
+                schedGroup = Process.THREAD_GROUP_DEFAULT;
+                app.adjType = "foreground-service";
+            } else if (app.forcingToForeground != null) {
+                // The user is aware of this app, so make it visible.
+                adj = PERCEPTIBLE_APP_ADJ;
+                schedGroup = Process.THREAD_GROUP_DEFAULT;
+                app.adjType = "force-foreground";
+                app.adjSource = app.forcingToForeground;
+            }
+        }
+        
+        if (adj > HEAVY_WEIGHT_APP_ADJ && app == mHeavyWeightProcess) {
+            // We don't want to kill the current heavy-weight process.
+            adj = HEAVY_WEIGHT_APP_ADJ;
+            schedGroup = Process.THREAD_GROUP_BG_NONINTERACTIVE;
+            app.adjType = "heavy";
+        }
 
+        if (adj > HOME_APP_ADJ && app == mHomeProcess) {
+            // This process is hosting what we currently consider to be the
+            // home app, so we don't want to let it go into the background.
+            adj = HOME_APP_ADJ;
+            schedGroup = Process.THREAD_GROUP_BG_NONINTERACTIVE;
+            app.adjType = "home";
+        }
+        
         //Slog.i(TAG, "OOM " + app + ": initial adj=" + adj);
         
         // By default, we use the computed adjustment.  It may be changed if
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index 19e7fae..a7f7866 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -1069,6 +1069,8 @@
 
         cdmaDataConnectionState = newCdmaDataConnectionState;
         networkType = newNetworkType;
+        // this new state has been applied - forget it until we get a new new state
+        newNetworkType = 0;
 
         newSS.setStateOutOfService(); // clean slate for next time
 
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index c107d17..bb99e45 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -957,6 +957,9 @@
 
         gprsState = newGPRSState;
         networkType = newNetworkType;
+        // this new state has been applied - forget it until we get a new new state
+        newNetworkType = 0;
+
 
         newSS.setStateOutOfService(); // clean slate for next time