Merge "Import revised translations."
diff --git a/api/current.txt b/api/current.txt
index b962234..40b63b1 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -16673,14 +16673,18 @@
   }
 
   public static final class ContactsContract.StreamItems implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemsColumns {
+    field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item";
     field public static final android.net.Uri CONTENT_LIMIT_URI;
     field public static final android.net.Uri CONTENT_PHOTO_URI;
+    field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item";
     field public static final android.net.Uri CONTENT_URI;
     field public static final java.lang.String MAX_ITEMS = "max_items";
   }
 
   public static final class ContactsContract.StreamItems.StreamItemPhotos implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemPhotosColumns {
     field public static final java.lang.String CONTENT_DIRECTORY = "photo";
+    field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item_photo";
+    field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item_photo";
   }
 
   protected static abstract interface ContactsContract.StreamItemsColumns {
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index a00f790..5c3a17a 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -345,7 +345,6 @@
             sb.append(" (no locale)");
         }
         switch (textLayoutDirection) {
-            case LocaleUtil.TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE: sb.append(" ?layoutdir"); break;
             case LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE: sb.append(" rtl"); break;
             default: sb.append(" layoutdir="); sb.append(textLayoutDirection); break;
         }
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index 5929cfb..88abf1a 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -43,6 +43,9 @@
 import com.android.internal.telephony.TelephonyIntents;
 import com.android.internal.util.AsyncChannel;
 
+import java.io.CharArrayWriter;
+import java.io.PrintWriter;
+
 /**
  * Track the state of mobile data connectivity. This is done by
  * receiving broadcast intents from the Phone process whenever
@@ -69,6 +72,11 @@
     private boolean mPrivateDnsRouteSet = false;
     private boolean mDefaultRouteSet = false;
 
+    // NOTE: these are only kept for debugging output; actual values are
+    // maintained in DataConnectionTracker.
+    protected boolean mUserDataEnabled = true;
+    protected boolean mPolicyDataEnabled = true;
+
     private Handler mHandler;
     private AsyncChannel mDataConnectionTrackerAc;
     private Messenger mMessenger;
@@ -458,6 +466,7 @@
         final AsyncChannel channel = mDataConnectionTrackerAc;
         if (channel != null) {
             channel.sendMessage(CMD_SET_USER_DATA_ENABLE, enabled ? ENABLED : DISABLED);
+            mUserDataEnabled = enabled;
         }
         if (VDBG) log("setUserDataEnable: X enabled=" + enabled);
     }
@@ -468,6 +477,7 @@
         final AsyncChannel channel = mDataConnectionTrackerAc;
         if (channel != null) {
             channel.sendMessage(CMD_SET_POLICY_DATA_ENABLE, enabled ? ENABLED : DISABLED);
+            mPolicyDataEnabled = enabled;
         }
     }
 
@@ -492,10 +502,12 @@
 
     @Override
     public String toString() {
-        StringBuffer sb = new StringBuffer("Mobile data state: ");
-
-        sb.append(mMobileDataState);
-        return sb.toString();
+        final CharArrayWriter writer = new CharArrayWriter();
+        final PrintWriter pw = new PrintWriter(writer);
+        pw.print("Mobile data state: "); pw.println(mMobileDataState);
+        pw.print("Data enabled: user="); pw.print(mUserDataEnabled);
+        pw.print(", policy="); pw.println(mPolicyDataEnabled);
+        return writer.toString();
     }
 
    /**
diff --git a/core/java/android/net/NetworkStats.java b/core/java/android/net/NetworkStats.java
index 5b883a0..e5f3273 100644
--- a/core/java/android/net/NetworkStats.java
+++ b/core/java/android/net/NetworkStats.java
@@ -19,6 +19,7 @@
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.os.SystemClock;
+import android.util.Log;
 import android.util.SparseBooleanArray;
 
 import com.android.internal.util.Objects;
@@ -38,6 +39,8 @@
  * @hide
  */
 public class NetworkStats implements Parcelable {
+    private static final String TAG = "NetworkStats";
+
     /** {@link #iface} value when interface details unavailable. */
     public static final String IFACE_ALL = null;
     /** {@link #uid} value when UID details unavailable. */
@@ -397,7 +400,10 @@
                 if (enforceMonotonic
                         && (entry.rxBytes < 0 || entry.rxPackets < 0 || entry.txBytes < 0
                                 || entry.txPackets < 0 || entry.operations < 0)) {
-                    throw new IllegalArgumentException("found non-monotonic values");
+                    Log.v(TAG, "lhs=" + this);
+                    Log.v(TAG, "rhs=" + value);
+                    throw new IllegalArgumentException(
+                            "found non-monotonic values at lhs[" + i + "] - rhs[" + j + "]");
                 }
                 if (clampNegative) {
                     entry.rxBytes = Math.max(0, entry.rxBytes);
diff --git a/core/java/android/net/NetworkStatsHistory.java b/core/java/android/net/NetworkStatsHistory.java
index b19949e..d07d899 100644
--- a/core/java/android/net/NetworkStatsHistory.java
+++ b/core/java/android/net/NetworkStatsHistory.java
@@ -482,12 +482,12 @@
         for (int i = start; i < bucketCount; i++) {
             pw.print(prefix);
             pw.print("  bucketStart="); pw.print(bucketStart[i]);
-            if (activeTime != null) pw.print(" activeTime="); pw.print(activeTime[i]);
-            if (rxBytes != null) pw.print(" rxBytes="); pw.print(rxBytes[i]);
-            if (rxPackets != null) pw.print(" rxPackets="); pw.print(rxPackets[i]);
-            if (txBytes != null) pw.print(" txBytes="); pw.print(txBytes[i]);
-            if (txPackets != null) pw.print(" txPackets="); pw.print(txPackets[i]);
-            if (operations != null) pw.print(" operations="); pw.print(operations[i]);
+            if (activeTime != null) { pw.print(" activeTime="); pw.print(activeTime[i]); }
+            if (rxBytes != null) { pw.print(" rxBytes="); pw.print(rxBytes[i]); }
+            if (rxPackets != null) { pw.print(" rxPackets="); pw.print(rxPackets[i]); }
+            if (txBytes != null) { pw.print(" txBytes="); pw.print(txBytes[i]); }
+            if (txPackets != null) { pw.print(" txPackets="); pw.print(txPackets[i]); }
+            if (operations != null) { pw.print(" operations="); pw.print(operations[i]); }
             pw.println();
         }
     }
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index e205f97..e9221fe 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -3024,6 +3024,16 @@
                 Uri.withAppendedPath(AUTHORITY_URI, "stream_items_limit");
 
         /**
+         * The MIME type of a directory of stream items.
+         */
+        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item";
+
+        /**
+         * The MIME type of a single stream item.
+         */
+        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item";
+
+        /**
          * Queries to {@link ContactsContract.StreamItems#CONTENT_LIMIT_URI} will
          * contain this column, with the value indicating the maximum number of
          * stream items that will be stored under any single raw contact.
@@ -3050,6 +3060,17 @@
              * The directory twig for this sub-table
              */
             public static final String CONTENT_DIRECTORY = "photo";
+
+            /**
+             * The MIME type of a directory of stream item photos.
+             */
+            public static final String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item_photo";
+
+            /**
+             * The MIME type of a single stream item photo.
+             */
+            public static final String CONTENT_ITEM_TYPE
+                    = "vnd.android.cursor.item/stream_item_photo";
         }
     }
 
diff --git a/core/java/android/text/TextDirectionHeuristics.java b/core/java/android/text/TextDirectionHeuristics.java
index 6debc6b..18b4040 100644
--- a/core/java/android/text/TextDirectionHeuristics.java
+++ b/core/java/android/text/TextDirectionHeuristics.java
@@ -17,6 +17,10 @@
 package android.text;
 
 
+import java.util.Locale;
+
+import android.util.LocaleUtil;
+
 /**
  * Some objects that implement TextDirectionHeuristic.
  * @hide
@@ -75,6 +79,11 @@
     public static final TextDirectionHeuristic CHARCOUNT_RTL =
         new TextDirectionHeuristicInternal(CharCount.INSTANCE_DEFAULT, true);
 
+    /**
+     * Force the paragraph direction to the Locale direction. Falls back to left to right.
+     */
+    public static final TextDirectionHeuristic LOCALE = TextDirectionHeuristicLocale.INSTANCE;
+
     private static enum TriState {
         TRUE, FALSE, UNKNOWN;
     }
@@ -300,4 +309,23 @@
         public static final float DEFAULT_THRESHOLD = 0.6f;
         public static final CharCount INSTANCE_DEFAULT = new CharCount(DEFAULT_THRESHOLD);
     }
+
+    /**
+     * Algorithm that uses the Locale direction to force the direction of a paragraph.
+     */
+    public static class TextDirectionHeuristicLocale extends TextDirectionHeuristicImpl {
+
+        public TextDirectionHeuristicLocale() {
+            super(null);
+        }
+
+        @Override
+        protected boolean defaultIsRtl() {
+            final int dir = LocaleUtil.getLayoutDirectionFromLocale(java.util.Locale.getDefault());
+            return (dir == LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE);
+        }
+
+        public static final TextDirectionHeuristicLocale INSTANCE =
+                new TextDirectionHeuristicLocale();
+    }
 }
diff --git a/core/java/android/util/LocaleUtil.java b/core/java/android/util/LocaleUtil.java
index 74a930f..763af73 100644
--- a/core/java/android/util/LocaleUtil.java
+++ b/core/java/android/util/LocaleUtil.java
@@ -32,11 +32,6 @@
     /**
      * @hide Do not use. Implementation not finished.
      */
-    public static final int TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE = -1;
-
-    /**
-     * @hide Do not use. Implementation not finished.
-     */
     public static final int TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE = 0;
 
     /**
@@ -54,7 +49,6 @@
      *
      * @param locale the Locale for which we want the layout direction. Can be null.
      * @return the layout direction. This may be one of:
-     * {@link #TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE} or
      * {@link #TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE} or
      * {@link #TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE}.
      *
@@ -63,17 +57,16 @@
      * @hide
      */
     public static int getLayoutDirectionFromLocale(Locale locale) {
-        if (locale == null || locale.equals(Locale.ROOT)) {
-            return TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE;
+        if (locale != null && !locale.equals(Locale.ROOT)) {
+            final String scriptSubtag = ICU.getScript(ICU.addLikelySubtags(locale.toString()));
+            if (scriptSubtag == null) return getLayoutDirectionFromFirstChar(locale);
+
+            if (scriptSubtag.equalsIgnoreCase(ARAB_SCRIPT_SUBTAG) ||
+                    scriptSubtag.equalsIgnoreCase(HEBR_SCRIPT_SUBTAG)) {
+                return TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE;
+            }
         }
 
-        final String scriptSubtag = ICU.getScript(ICU.addLikelySubtags(locale.toString()));
-        if (scriptSubtag == null) return getLayoutDirectionFromFirstChar(locale);
-
-        if (scriptSubtag.equalsIgnoreCase(ARAB_SCRIPT_SUBTAG) ||
-                scriptSubtag.equalsIgnoreCase(HEBR_SCRIPT_SUBTAG)) {
-            return TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE;
-        }
         return TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE;
     }
 
@@ -84,7 +77,6 @@
      *
      * @param locale
      * @return the layout direction. This may be one of:
-     * {@link #TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE} or
      * {@link #TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE} or
      * {@link #TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE}.
      *
@@ -94,13 +86,13 @@
      */
     private static int getLayoutDirectionFromFirstChar(Locale locale) {
         switch(Character.getDirectionality(locale.getDisplayName(locale).charAt(0))) {
-            case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
-                return TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE;
             case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
             case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
                 return TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE;
+
+            case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
             default:
-                return TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE;
+                return TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE;
         }
     }
 }
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index 5b592e0..2bf16d8 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -413,8 +413,8 @@
                 if (error != EGL_SUCCESS) {
                     // something bad has happened revert to
                     // normal rendering.
-                    fallback(error != EGL11.EGL_CONTEXT_LOST);
                     Log.w(LOG_TAG, "EGL error: " + GLUtils.getEGLErrorString(error));
+                    fallback(error != EGL11.EGL_CONTEXT_LOST);
                 }
             }
         }
@@ -702,8 +702,9 @@
 
         @Override
         void setup(int width, int height) {
-            checkCurrent();
-            mCanvas.setViewport(width, height);
+            if (validate()) {
+                mCanvas.setViewport(width, height);
+            }
         }
 
         boolean canDraw() {
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 6ea863f..a0cc287 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1352,7 +1352,7 @@
                     mAttachInfo.mHardwareRenderer != null &&
                     mAttachInfo.mHardwareRenderer.isEnabled())) {
                 mAttachInfo.mHardwareRenderer.setup(mWidth, mHeight);
-                if (!hwInitialized) {
+                if (!hwInitialized && mAttachInfo.mHardwareRenderer.isEnabled()) {
                     mAttachInfo.mHardwareRenderer.invalidate(mHolder);
                 }
             }
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 8c3c212..6238b72 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -43,6 +43,7 @@
 import android.graphics.Rect;
 import android.graphics.RectF;
 import android.graphics.Region;
+import android.graphics.RegionIterator;
 import android.graphics.Shader;
 import android.graphics.drawable.Drawable;
 import android.net.Proxy;
@@ -605,8 +606,9 @@
     // know to handle Shift and arrows natively first
     private boolean mAccessibilityScriptInjected;
 
+    static final boolean USE_WEBKIT_RINGS = true;
     // the color used to highlight the touch rectangles
-    private static final int mHightlightColor = 0x33000000;
+    private static final int mHightlightColor = 0x6633b5e5;
     // the round corner for the highlight path
     private static final float TOUCH_HIGHLIGHT_ARC = 5.0f;
     // the region indicating where the user touched on the screen
@@ -619,6 +621,7 @@
     private Paint mTouchCrossHairColor;
     private int mTouchHighlightX;
     private int mTouchHighlightY;
+    private long mTouchHighlightRequested;
 
     // Basically this proxy is used to tell the Video to update layer tree at
     // SetBaseLayer time and to pause when WebView paused.
@@ -3992,7 +3995,7 @@
         return super.drawChild(canvas, child, drawingTime);
     }
 
-    private void drawContent(Canvas canvas) {
+    private void drawContent(Canvas canvas, boolean drawRings) {
         // Update the buttons in the picture, so when we draw the picture
         // to the screen, they are in the correct state.
         // Tell the native side if user is a) touching the screen,
@@ -4004,7 +4007,8 @@
         nativeRecordButtons(hasFocus() && hasWindowFocus(),
                             mTouchMode == TOUCH_SHORTPRESS_START_MODE
                             || mTrackballDown || mGotCenterDown, false);
-        drawCoreAndCursorRing(canvas, mBackgroundColor, mDrawCursorRing);
+        drawCoreAndCursorRing(canvas, mBackgroundColor,
+                mDrawCursorRing && drawRings);
     }
 
     /**
@@ -4068,7 +4072,15 @@
         if (mTitleBar != null) {
             canvas.translate(0, getTitleHeight());
         }
-        drawContent(canvas);
+        boolean drawJavaRings = !mTouchHighlightRegion.isEmpty()
+                && (mTouchMode == TOUCH_INIT_MODE
+                || mTouchMode == TOUCH_SHORTPRESS_START_MODE
+                || mTouchMode == TOUCH_SHORTPRESS_MODE);
+        boolean drawNativeRings = !drawJavaRings;
+        if (USE_WEBKIT_RINGS) {
+            drawNativeRings = !drawJavaRings && !isInTouchMode();
+        }
+        drawContent(canvas, drawNativeRings);
         canvas.restoreToCount(saveCount);
 
         if (AUTO_REDRAW_HACK && mAutoRedraw) {
@@ -4081,16 +4093,22 @@
         }
 
         // paint the highlight in the end
-        if (!mTouchHighlightRegion.isEmpty()) {
-            if (mTouchHightlightPaint == null) {
-                mTouchHightlightPaint = new Paint();
-                mTouchHightlightPaint.setColor(mHightlightColor);
-                mTouchHightlightPaint.setAntiAlias(true);
-                mTouchHightlightPaint.setPathEffect(new CornerPathEffect(
-                        TOUCH_HIGHLIGHT_ARC));
+        if (drawJavaRings) {
+            long delay = System.currentTimeMillis() - mTouchHighlightRequested;
+            if (delay < ViewConfiguration.getTapTimeout()) {
+                Rect r = mTouchHighlightRegion.getBounds();
+                postInvalidateDelayed(delay, r.left, r.top, r.right, r.bottom);
+            } else {
+                if (mTouchHightlightPaint == null) {
+                    mTouchHightlightPaint = new Paint();
+                    mTouchHightlightPaint.setColor(mHightlightColor);
+                }
+                RegionIterator iter = new RegionIterator(mTouchHighlightRegion);
+                Rect r = new Rect();
+                while (iter.next(r)) {
+                    canvas.drawRect(r, mTouchHightlightPaint);
+                }
             }
-            canvas.drawPath(mTouchHighlightRegion.getBoundaryPath(),
-                    mTouchHightlightPaint);
         }
         if (DEBUG_TOUCH_HIGHLIGHT) {
             if (getSettings().getNavDump()) {
@@ -4113,11 +4131,10 @@
         }
     }
 
-    private void removeTouchHighlight(boolean removePendingMessage) {
-        if (removePendingMessage) {
-            mWebViewCore.removeMessages(EventHub.GET_TOUCH_HIGHLIGHT_RECTS);
-        }
-        mWebViewCore.sendMessage(EventHub.REMOVE_TOUCH_HIGHLIGHT_RECTS);
+    private void removeTouchHighlight() {
+        mWebViewCore.removeMessages(EventHub.GET_TOUCH_HIGHLIGHT_RECTS);
+        mPrivateHandler.removeMessages(SET_TOUCH_HIGHLIGHT_RECTS);
+        setTouchHighlightRects(null);
     }
 
     @Override
@@ -5786,8 +5803,8 @@
                     mPrivateHandler.removeMessages(RESUME_WEBCORE_PRIORITY);
                 } else if (mPrivateHandler.hasMessages(RELEASE_SINGLE_TAP)) {
                     mPrivateHandler.removeMessages(RELEASE_SINGLE_TAP);
-                    if (getSettings().supportTouchOnly()) {
-                        removeTouchHighlight(true);
+                    if (USE_WEBKIT_RINGS || getSettings().supportTouchOnly()) {
+                        removeTouchHighlight();
                     }
                     if (deltaX * deltaX + deltaY * deltaY < mDoubleTapSlopSquare) {
                         mTouchMode = TOUCH_DOUBLE_TAP_MODE;
@@ -5810,15 +5827,19 @@
                         mWebViewCore.sendMessage(
                                 EventHub.UPDATE_FRAME_CACHE_IF_LOADING);
                     }
-                    if (getSettings().supportTouchOnly()) {
+                    if (USE_WEBKIT_RINGS || getSettings().supportTouchOnly()) {
                         TouchHighlightData data = new TouchHighlightData();
                         data.mX = contentX;
                         data.mY = contentY;
+                        data.mNativeLayerRect = new Rect();
+                        data.mNativeLayer = nativeScrollableLayer(
+                                contentX, contentY, data.mNativeLayerRect, null);
                         data.mSlop = viewToContentDimension(mNavSlop);
+                        mTouchHighlightRegion.setEmpty();
                         if (!mBlockWebkitViewMessages) {
-                            mWebViewCore.sendMessageDelayed(
-                                    EventHub.GET_TOUCH_HIGHLIGHT_RECTS, data,
-                                    ViewConfiguration.getTapTimeout());
+                            mTouchHighlightRequested = System.currentTimeMillis();
+                            mWebViewCore.sendMessageAtFrontOfQueue(
+                                    EventHub.GET_TOUCH_HIGHLIGHT_RECTS, data);
                         }
                         if (DEBUG_TOUCH_HIGHLIGHT) {
                             if (getSettings().getNavDump()) {
@@ -5905,8 +5926,8 @@
                     if (mTouchMode == TOUCH_DOUBLE_TAP_MODE) {
                         mTouchMode = TOUCH_INIT_MODE;
                     }
-                    if (getSettings().supportTouchOnly()) {
-                        removeTouchHighlight(true);
+                    if (USE_WEBKIT_RINGS || getSettings().supportTouchOnly()) {
+                        removeTouchHighlight();
                     }
                 }
                 // pass the touch events from UI thread to WebCore thread
@@ -6487,8 +6508,8 @@
         mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
         mPrivateHandler.removeMessages(DRAG_HELD_MOTIONLESS);
         mPrivateHandler.removeMessages(AWAKEN_SCROLL_BARS);
-        if (getSettings().supportTouchOnly()) {
-            removeTouchHighlight(true);
+        if (USE_WEBKIT_RINGS || getSettings().supportTouchOnly()) {
+            removeTouchHighlight();
         }
         mHeldMotionless = MOTIONLESS_TRUE;
         mTouchMode = TOUCH_DONE_MODE;
@@ -7140,8 +7161,20 @@
         int contentX = viewToContentX(mLastTouchX + mScrollX);
         int contentY = viewToContentY(mLastTouchY + mScrollY);
         int slop = viewToContentDimension(mNavSlop);
+        if (USE_WEBKIT_RINGS && !mTouchHighlightRegion.isEmpty()) {
+            // set mTouchHighlightRequested to 0 to cause an immediate
+            // drawing of the touch rings
+            mTouchHighlightRequested = 0;
+            invalidate(mTouchHighlightRegion.getBounds());
+            mPrivateHandler.postDelayed(new Runnable() {
+                @Override
+                public void run() {
+                    removeTouchHighlight();
+                }
+            }, ViewConfiguration.getPressedStateDuration());
+        }
         if (getSettings().supportTouchOnly()) {
-            removeTouchHighlight(false);
+            removeTouchHighlight();
             WebViewCore.TouchUpData touchUpData = new WebViewCore.TouchUpData();
             // use "0" as generation id to inform WebKit to use the same x/y as
             // it used when processing GET_TOUCH_HIGHLIGHT_RECTS
@@ -8031,8 +8064,8 @@
                     break;
                 }
                 case SWITCH_TO_LONGPRESS: {
-                    if (getSettings().supportTouchOnly()) {
-                        removeTouchHighlight(false);
+                    if (USE_WEBKIT_RINGS || getSettings().supportTouchOnly()) {
+                        removeTouchHighlight();
                     }
                     if (inFullScreenMode() || mDeferTouchProcess) {
                         TouchEventData ted = new TouchEventData();
@@ -8354,26 +8387,9 @@
                     break;
 
                 case SET_TOUCH_HIGHLIGHT_RECTS:
-                    invalidate(mTouchHighlightRegion.getBounds());
-                    mTouchHighlightRegion.setEmpty();
-                    if (msg.obj != null) {
-                        ArrayList<Rect> rects = (ArrayList<Rect>) msg.obj;
-                        for (Rect rect : rects) {
-                            Rect viewRect = contentToViewRect(rect);
-                            // some sites, like stories in nytimes.com, set
-                            // mouse event handler in the top div. It is not
-                            // user friendly to highlight the div if it covers
-                            // more than half of the screen.
-                            if (viewRect.width() < getWidth() >> 1
-                                    || viewRect.height() < getHeight() >> 1) {
-                                mTouchHighlightRegion.union(viewRect);
-                                invalidate(viewRect);
-                            } else {
-                                Log.w(LOGTAG, "Skip the huge selection rect:"
-                                        + viewRect);
-                            }
-                        }
-                    }
+                    @SuppressWarnings("unchecked")
+                    ArrayList<Rect> rects = (ArrayList<Rect>) msg.obj;
+                    setTouchHighlightRects(rects);
                     break;
 
                 case SAVE_WEBARCHIVE_FINISHED:
@@ -8410,6 +8426,28 @@
         }
     }
 
+    private void setTouchHighlightRects(ArrayList<Rect> rects) {
+        invalidate(mTouchHighlightRegion.getBounds());
+        mTouchHighlightRegion.setEmpty();
+        if (rects != null) {
+            for (Rect rect : rects) {
+                Rect viewRect = contentToViewRect(rect);
+                // some sites, like stories in nytimes.com, set
+                // mouse event handler in the top div. It is not
+                // user friendly to highlight the div if it covers
+                // more than half of the screen.
+                if (viewRect.width() < getWidth() >> 1
+                        || viewRect.height() < getHeight() >> 1) {
+                    mTouchHighlightRegion.union(viewRect);
+                } else {
+                    Log.w(LOGTAG, "Skip the huge selection rect:"
+                            + viewRect);
+                }
+            }
+            invalidate(mTouchHighlightRegion.getBounds());
+        }
+    }
+
     /** @hide Called by JNI when pages are swapped (only occurs with hardware
      * acceleration) */
     protected void pageSwapCallback() {
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index fe07a76..3ca3eaa 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -801,6 +801,8 @@
         int mX;
         int mY;
         int mSlop;
+        int mNativeLayer;
+        Rect mNativeLayerRect;
     }
 
     static class AutoFillData {
@@ -1015,7 +1017,6 @@
         static final int REMOVE_PACKAGE_NAME = 186;
 
         static final int GET_TOUCH_HIGHLIGHT_RECTS = 187;
-        static final int REMOVE_TOUCH_HIGHLIGHT_RECTS = 188;
 
         // accessibility support
         static final int MODIFY_SELECTION = 190;
@@ -1172,6 +1173,7 @@
                                     loadParams.mMimeType,
                                     loadParams.mEncoding,
                                     loadParams.mHistoryUrl);
+                            nativeContentInvalidateAll();
                             break;
 
                         case STOP_LOADING:
@@ -1576,6 +1578,10 @@
 
                         case GET_TOUCH_HIGHLIGHT_RECTS:
                             TouchHighlightData d = (TouchHighlightData) msg.obj;
+                            if (d.mNativeLayer != 0) {
+                                nativeScrollLayer(d.mNativeLayer,
+                                        d.mNativeLayerRect);
+                            }
                             ArrayList<Rect> rects = nativeGetTouchHighlightRects
                                     (d.mX, d.mY, d.mSlop);
                             mWebView.mPrivateHandler.obtainMessage(
@@ -1583,12 +1589,6 @@
                                     .sendToTarget();
                             break;
 
-                        case REMOVE_TOUCH_HIGHLIGHT_RECTS:
-                            mWebView.mPrivateHandler.obtainMessage(
-                                    WebView.SET_TOUCH_HIGHLIGHT_RECTS, null)
-                                    .sendToTarget();
-                            break;
-
                         case USE_MOCK_DEVICE_ORIENTATION:
                             useMockDeviceOrientation();
                             break;
@@ -2224,9 +2224,9 @@
         }
 
         // remove the touch highlight when moving to a new page
-        if (getSettings().supportTouchOnly()) {
-            mEventHub.sendMessage(Message.obtain(null,
-                    EventHub.REMOVE_TOUCH_HIGHLIGHT_RECTS));
+        if (WebView.USE_WEBKIT_RINGS || getSettings().supportTouchOnly()) {
+            mWebView.mPrivateHandler.sendEmptyMessage(
+                    WebView.SET_TOUCH_HIGHLIGHT_RECTS);
         }
 
         // reset the scroll position, the restored offset and scales
diff --git a/core/java/android/widget/SpellChecker.java b/core/java/android/widget/SpellChecker.java
index 5e3b956..ff13dcb 100644
--- a/core/java/android/widget/SpellChecker.java
+++ b/core/java/android/widget/SpellChecker.java
@@ -142,7 +142,7 @@
             final int end = editable.getSpanEnd(spellCheckSpan);
 
             // Do not check this word if the user is currently editing it
-            if (start >= 0 && end >= 0 && (selectionEnd < start || selectionStart > end)) {
+            if (start >= 0 && end > start && (selectionEnd < start || selectionStart > end)) {
                 final String word = editable.subSequence(start, end).toString();
                 spellCheckSpan.setSpellCheckInProgress();
                 textInfos[textInfosCount++] = new TextInfo(word, mCookie, mIds[i]);
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index c92b5f9..c021c48 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -10886,6 +10886,11 @@
 
     @Override
     protected void resolveTextDirection() {
+        if (hasPasswordTransformationMethod()) {
+            mTextDir = TextDirectionHeuristics.LOCALE;
+            return;
+        }
+
         // Always need to resolve layout direction first
         final boolean defaultIsRtl = (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL);
 
diff --git a/core/res/res/anim/fast_fade_in.xml b/core/res/res/anim/fast_fade_in.xml
new file mode 100644
index 0000000..296eb49
--- /dev/null
+++ b/core/res/res/anim/fast_fade_in.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/res/anim/fade_in.xml
+**
+** 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
+**
+**     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.
+*/
+-->
+
+<alpha xmlns:android="http://schemas.android.com/apk/res/android"
+        android:interpolator="@interpolator/decelerate_quad"
+        android:fromAlpha="0.0"
+        android:toAlpha="1.0"
+        android:duration="80" />
diff --git a/core/res/res/anim/fast_fade_out.xml b/core/res/res/anim/fast_fade_out.xml
new file mode 100644
index 0000000..c534771
--- /dev/null
+++ b/core/res/res/anim/fast_fade_out.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/res/anim/fade_out.xml
+**
+** 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
+**
+**     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.
+*/
+-->
+
+<alpha xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@interpolator/accelerate_quad"
+    android:fromAlpha="1.0"
+    android:toAlpha="0.0"
+    android:duration="140"
+/>
diff --git a/core/res/res/drawable-hdpi/textfield_search_default_holo_dark.9.png b/core/res/res/drawable-hdpi/textfield_search_default_holo_dark.9.png
index 288b809..3cbafb9 100644
--- a/core/res/res/drawable-hdpi/textfield_search_default_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/textfield_search_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/textfield_search_default_holo_light.9.png b/core/res/res/drawable-hdpi/textfield_search_default_holo_light.9.png
index 7866e06..7b019844 100644
--- a/core/res/res/drawable-hdpi/textfield_search_default_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/textfield_search_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/textfield_search_right_default_holo_dark.9.png b/core/res/res/drawable-hdpi/textfield_search_right_default_holo_dark.9.png
index 699552d..2b6340ac 100644
--- a/core/res/res/drawable-hdpi/textfield_search_right_default_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/textfield_search_right_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/textfield_search_right_default_holo_light.9.png b/core/res/res/drawable-hdpi/textfield_search_right_default_holo_light.9.png
index 543afa2..49c8c05 100644
--- a/core/res/res/drawable-hdpi/textfield_search_right_default_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/textfield_search_right_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/textfield_search_right_selected_holo_dark.9.png b/core/res/res/drawable-hdpi/textfield_search_right_selected_holo_dark.9.png
index e1a5e70..df1db0e 100644
--- a/core/res/res/drawable-hdpi/textfield_search_right_selected_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/textfield_search_right_selected_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/textfield_search_right_selected_holo_light.9.png b/core/res/res/drawable-hdpi/textfield_search_right_selected_holo_light.9.png
index b778741..fbc46d0 100644
--- a/core/res/res/drawable-hdpi/textfield_search_right_selected_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/textfield_search_right_selected_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/textfield_search_selected_holo_dark.9.png b/core/res/res/drawable-hdpi/textfield_search_selected_holo_dark.9.png
index 8a5d810..87e31e1 100644
--- a/core/res/res/drawable-hdpi/textfield_search_selected_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/textfield_search_selected_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/textfield_search_selected_holo_light.9.png b/core/res/res/drawable-hdpi/textfield_search_selected_holo_light.9.png
index c423a74..080fc78 100644
--- a/core/res/res/drawable-hdpi/textfield_search_selected_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/textfield_search_selected_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_default_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_search_default_holo_dark.9.png
index 99840b1..039af2f 100644
--- a/core/res/res/drawable-mdpi/textfield_search_default_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_default_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_search_default_holo_light.9.png
index 6bd9509..eb70db6 100644
--- a/core/res/res/drawable-mdpi/textfield_search_default_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_right_default_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_search_right_default_holo_dark.9.png
index 22493de..9b45bb7 100644
--- a/core/res/res/drawable-mdpi/textfield_search_right_default_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_right_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_right_default_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_search_right_default_holo_light.9.png
index 02b491c..67b96e2 100644
--- a/core/res/res/drawable-mdpi/textfield_search_right_default_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_right_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_dark.9.png
index 16c4c1a..b09f9dc 100644
--- a/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_light.9.png
index e474bc5..821ad91 100644
--- a/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_selected_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_search_selected_holo_dark.9.png
index c56ab9c..c3a7a2e 100644
--- a/core/res/res/drawable-mdpi/textfield_search_selected_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_selected_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_selected_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_search_selected_holo_light.9.png
index a2e5944..e769cb5 100644
--- a/core/res/res/drawable-mdpi/textfield_search_selected_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_selected_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/textfield_search_default_holo_dark.9.png b/core/res/res/drawable-xhdpi/textfield_search_default_holo_dark.9.png
index 1a1a9c4..59a9a1b 100644
--- a/core/res/res/drawable-xhdpi/textfield_search_default_holo_dark.9.png
+++ b/core/res/res/drawable-xhdpi/textfield_search_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/textfield_search_default_holo_light.9.png b/core/res/res/drawable-xhdpi/textfield_search_default_holo_light.9.png
index 462cea6..5d472c8 100644
--- a/core/res/res/drawable-xhdpi/textfield_search_default_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/textfield_search_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/textfield_search_right_default_holo_dark.9.png b/core/res/res/drawable-xhdpi/textfield_search_right_default_holo_dark.9.png
index 3e178b2..3dbef60 100644
--- a/core/res/res/drawable-xhdpi/textfield_search_right_default_holo_dark.9.png
+++ b/core/res/res/drawable-xhdpi/textfield_search_right_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/textfield_search_right_default_holo_light.9.png b/core/res/res/drawable-xhdpi/textfield_search_right_default_holo_light.9.png
index 4c34b93..197c2bc 100644
--- a/core/res/res/drawable-xhdpi/textfield_search_right_default_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/textfield_search_right_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/textfield_search_right_selected_holo_dark.9.png b/core/res/res/drawable-xhdpi/textfield_search_right_selected_holo_dark.9.png
index cf1b3ca..a765e5b 100644
--- a/core/res/res/drawable-xhdpi/textfield_search_right_selected_holo_dark.9.png
+++ b/core/res/res/drawable-xhdpi/textfield_search_right_selected_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/textfield_search_right_selected_holo_light.9.png b/core/res/res/drawable-xhdpi/textfield_search_right_selected_holo_light.9.png
index 0ee383b..30a3237 100644
--- a/core/res/res/drawable-xhdpi/textfield_search_right_selected_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/textfield_search_right_selected_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/textfield_search_selected_holo_dark.9.png b/core/res/res/drawable-xhdpi/textfield_search_selected_holo_dark.9.png
index 42c019e..3c8ed1e 100644
--- a/core/res/res/drawable-xhdpi/textfield_search_selected_holo_dark.9.png
+++ b/core/res/res/drawable-xhdpi/textfield_search_selected_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/textfield_search_selected_holo_light.9.png b/core/res/res/drawable-xhdpi/textfield_search_selected_holo_light.9.png
index 63efe71..f69ebc5 100644
--- a/core/res/res/drawable-xhdpi/textfield_search_selected_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/textfield_search_selected_holo_light.9.png
Binary files differ
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 9455124..a3e460e 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2665,8 +2665,8 @@
 
      <!-- A notification is shown when a user's selected SSID is later disabled due to connectivity problems.  This is the notification's title / ticker. -->
      <string name="wifi_watchdog_network_disabled">Couldn\'t connect to Wi-Fi</string>
-     <!-- A notification is shown when a user's selected SSID is later disabled due to connectivity problems.  This is a partial string of the message, which will also include the (possibly truncated) hotspot name. -->
-    <string name="wifi_watchdog_network_disabled_detailed"> has a poor internet connection.</string>
+     <!-- A notification is shown when a user's selected SSID is later disabled due to connectivity problems.  The complete alert msg is: <hotspot name> + this string, i.e. "Linksys has a poor internet connection" -->
+    <string name="wifi_watchdog_network_disabled_detailed">\u0020has a poor internet connection.</string>
 
     <!-- Do not translate. Default access point SSID used for tethering -->
     <string name="wifi_tether_configure_ssid_default" translatable="false">AndroidAP</string>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index d8d613a..5a76ed4 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -448,7 +448,7 @@
         <item name="android:textColor">?textColorSecondary</item>
         <item name="android:textSize">14sp</item>
         <item name="android:gravity">center_vertical</item>
-        <item name="android:paddingLeft">5sp</item>
+        <item name="android:paddingLeft">8dip</item>
     </style>
 
     <style name="Widget.TextView.ListSeparator.White">
@@ -1073,8 +1073,8 @@
 
     <!-- Style for animating text selection handles. -->
     <style name="Animation.TextSelectHandle">
-        <item name="windowEnterAnimation">@android:anim/fade_in</item>
-        <item name="windowExitAnimation">@android:anim/fade_out</item>
+        <item name="windowEnterAnimation">@android:anim/fast_fade_in</item>
+        <item name="windowExitAnimation">@android:anim/fast_fade_out</item>
     </style>
 
     <!-- Style for the popup window that contains text suggestions. -->
diff --git a/core/tests/coretests/src/android/util/LocaleUtilTest.java b/core/tests/coretests/src/android/util/LocaleUtilTest.java
index 203781f..ff3d539 100644
--- a/core/tests/coretests/src/android/util/LocaleUtilTest.java
+++ b/core/tests/coretests/src/android/util/LocaleUtilTest.java
@@ -23,7 +23,6 @@
 import dalvik.annotation.TestTargetNew;
 
 import static android.util.LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE;
-import static android.util.LocaleUtil.TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE;
 
 public class LocaleUtilTest extends AndroidTestCase {
 
@@ -33,7 +32,7 @@
         args = {Locale.class}
     )
     public void testGetLayoutDirectionFromLocale() {
-        assertEquals(TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE,
+        assertEquals(TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE,
                 LocaleUtil.getLayoutDirectionFromLocale(null));
 
         assertEquals(TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE,
@@ -59,7 +58,7 @@
         assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE,
             LocaleUtil.getLayoutDirectionFromLocale(Locale.US));
 
-        assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE,
+        assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE,
             LocaleUtil.getLayoutDirectionFromLocale(Locale.ROOT));
 
         assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE,
diff --git a/docs/html/guide/appendix/install-location.jd b/docs/html/guide/appendix/install-location.jd
index 617f4fc..292d3e7 100644
--- a/docs/html/guide/appendix/install-location.jd
+++ b/docs/html/guide/appendix/install-location.jd
@@ -195,7 +195,7 @@
 <p>In simple terms, anything that does not use the features listed in the previous section
 are safe when installed on external storage. Large games are more commonly the types of
 applications that should allow installation on external storage, because games don't typically
-provide additional services when innactive. When external storage becomes unavailable and a game
+provide additional services when inactive. When external storage becomes unavailable and a game
 process is killed, there should be no visible effect when the storage becomes available again and
 the user restarts the game (assuming that the game properly saved its state during the normal
 <a href="{@docRoot}guide/topics/fundamentals/activities.html#Lifecycle">Activity lifecycle</a>).</p>
diff --git a/docs/html/guide/developing/device.jd b/docs/html/guide/developing/device.jd
index bde170e..e08119f 100644
--- a/docs/html/guide/developing/device.jd
+++ b/docs/html/guide/developing/device.jd
@@ -41,7 +41,8 @@
 
 <p class="note"><strong>Note:</strong> When developing on a device, keep in mind that you should
 still use the <a
-href="{@docRoot}guide/developing/devices/emulator.html">Android emulator</a> to test your application
+href="{@docRoot}guide/developing/devices/emulator.html">Android emulator</a> to test your
+application
 on configurations that are not equivalent to those of your real device. Although the emulator
 does not allow you to test every device feature (such as the accelerometer), it does
 allow you to verify that your application functions properly on different versions of the Android
@@ -56,14 +57,22 @@
 <ol>
   <li>Declare your application as "debuggable" in your Android Manifest.
     <p>In Eclipse, you can do this from the <b>Application</b> tab when viewing the Manifest
-    (on the right side, set <b>Debuggable</b> to <em>true</em>). Otherwise, in the <code>AndroidManifest.xml</code>
-    file, add <code>android:debuggable="true"</code> to the <code>&lt;application></code> element.</p>
+    (on the right side, set <b>Debuggable</b> to <em>true</em>). Otherwise, in the
+<code>AndroidManifest.xml</code>
+    file, add <code>android:debuggable="true"</code> to the <code>&lt;application></code>
+element.</p>
+  </li>
+  <li>Set up your device to allow installation of non-Market applications. <p>On
+the device, go to <strong>Settings > Applications</strong> and enable
+
+<strong>Unknown sources</strong>.</p>
+  
   </li>
   <li>Turn on "USB Debugging" on your device.
-    <p>On the device, go to the home screen, press <b>MENU</b>, select <b>Applications</b> > <b>Development</b>,
-    then enable <b>USB debugging</b>.</p>
+    <p>On the device, go to <strong>Settings > Applications > Development</strong>
+    and enable <strong>USB debugging</strong>.</p>
   </li>
-  <li>Setup your system to detect your device.
+  <li>Set up your system to detect your device.
     <ul>
       <li>If you're developing on Windows, you need to install a USB driver
       for adb. If you're using an Android Developer Phone (ADP), Nexus One, or Nexus S,
@@ -71,27 +80,37 @@
       Driver</a>. Otherwise, you can find a link to the appropriate OEM driver in the
   <a href="{@docRoot}sdk/oem-usb.html">OEM USB Drivers</a> document.</li>
       <li>If you're developing on Mac OS X, it just works. Skip this step.</li>
-      <li>If you're developing on Ubuntu Linux, you need to add a rules file
-that contains a USB configuration for each type of device you want to use for
-development. Each device manufacturer uses a different vendor ID. The
-example rules files below show how to add an entry for a single vendor ID
-(the HTC vendor ID). In order to support more devices, you will need additional
-lines of the same format that provide a different value for the
-<code>SYSFS{idVendor}</code> property. For other IDs, see the table of <a
-href="#VendorIds">USB Vendor IDs</a>, below.
-        <ol>
-          <li>Log in as root and create this file:
-            <code>/etc/udev/rules.d/51-android.rules</code>.
-            <p>For Gusty/Hardy, edit the file to read:<br/>
-            <code>SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4",
-            MODE="0666"</code></p>
+      
+      <li>If you're developing on Ubuntu Linux, you need to add a <a
+href="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html">
+<code>udev</code></a> 
+rules file that contains a USB configuration for each type of device
+you want to use for development. In the rules file, each device manufacturer
+is identified by a unique vendor ID, as specified by the
+<code>ATTR{idVendor}</code> property. For a list of vendor IDs, see  <a
+href="#VendorIds">USB Vendor IDs</a>, below. To set up device detection on
+Ubuntu Linux:
 
-            <p>For Dapper, edit the file to read:<br/>
-            <code>SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4",
-            MODE="0666"</code></p>
+        <ol type="a">
+          <li>Log in as root and create this file:
+            <code>/etc/udev/rules.d/51-android.rules</code></span>.
+            <p>Use this format to add each vendor to the file:<br/>
+              <code>SUBSYSTEM==&quot;usb&quot;, ATTR{idVendor}==&quot;0bb4&quot;, MODE=&quot;0666&quot;, GROUP=&quot;plugdev&quot;</code>
+              <br /><br />
+              
+              In this example, the vendor ID is for HTC. The <code>MODE</code>
+assignment specifies read/write permissions, and <code>GROUP</code> defines
+which Unix group  owns the device node. </p>
+            
+            <p class="note"><strong>Note:</strong> The rule syntax
+may vary slightly depending on your  environment. Consult the <code>udev</code>
+documentation for your system as needed. For an overview of rule syntax, see
+this guide to <a
+href="http://www.reactivated.net/writing_udev_rules.html">writing udev
+rules</a>.</p>
           </li>
           <li>Now execute:<br/>
-              <code>chmod a+r /etc/udev/rules.d/51-android.rules</code>
+            <code>chmod a+r /etc/udev/rules.d/51-android.rules</code>
           </li>
         </ol>
       </li>
@@ -99,79 +118,143 @@
   </li>
 </ol>
 
-<p>You can verify that your device is connected by executing <code>adb devices</code> from your 
-SDK {@code platform-tools/} directory. If connected, you'll see the device name listed as a
-"device."</p>
+<p>You can verify that your device is connected by executing <code>adb
+devices</code> from your SDK {@code platform-tools/} directory. If connected,
+you'll see the device name listed as a "device."</p>
 
-<p>If using Eclipse, run or debug as usual. You will be presented
-with a <b>Device Chooser</b> dialog that lists the available emulator(s) and connected device(s).
-Select the device upon which you want to install and run the application.</p>
+<p>If using Eclipse, run or debug your application as usual. You will be
+presented with a <b>Device Chooser</b> dialog that lists the available
+emulator(s) and connected device(s). Select the device upon which you want to
+install and run the application.</p>
 
-<p>If using the <a href="{@docRoot}guide/developing/tools/adb.html">Android Debug Bridge</a> (adb),
-you can issue commands with the <code>-d</code> flag to target your
-connected device.</p>
-
+<p>If using the <a href="{@docRoot}guide/developing/tools/adb.html">Android
+Debug Bridge</a> (adb), you can issue commands with the <code>-d</code> flag to
+target your connected device.</p>
 
 <h3 id="VendorIds">USB Vendor IDs</h3>
-<p>This table provides a reference to the vendor IDs needed in order to add
-USB device support on Linux. The USB Vendor ID is the value given to the
-<code>SYSFS{idVendor}</code> property in the rules file, as described in step 3, above.</p>
+
+<p>This table provides a reference to the vendor IDs needed in order to add USB
+device support on Linux. The USB Vendor ID is the value given to the
+<code>ATTR{idVendor}</code> property in the rules file, as described 
+above.</p>
 
 <table>
   <tr>
     <th>Company</th><th>USB Vendor ID</th></tr>
   <tr>
     <td>Acer</td>
-    <td><code>0502</code></td></tr>
+    <td><code>0502</code></td>
+  </tr>
+  <tr>
+    <td>ASUS</td>
+    <td><code>0B05</code></td>
+  </tr>
   <tr>
     <td>Dell</td>
-    <td><code>413c</code></td></tr>
+    <td><code>413C</code></td>
+  </tr>
   <tr>
     <td>Foxconn</td>
-    <td><code>0489</code></td></tr>
+    <td><code>0489</code></td>
+  </tr>
   <tr>
     <td>Garmin-Asus</td>
-    <td><code>091E</code></td></tr>
+    <td><code>091E</code></td>
+  </tr>
   <tr>
     <td>Google</td>
-    <td><code>18d1</code></td></tr>
+    <td><code>18D1</code></td>
+  </tr>
   <tr>
     <td>HTC</td>
-    <td><code>0bb4</code></td></tr>
+    <td><code>0BB4</code></td>
+  </tr>
   <tr>
     <td>Huawei</td>
-    <td><code>12d1</code></td></tr>
+    <td><code>12D1</code></td>
+  </tr>
   <tr>
     <td>K-Touch</td>
-    <td><code>24e3</code></td></tr>
+    <td><code>24E3</code></td>
+  </tr>
+  <tr>
+    <td>KT Tech</td>
+    <td><code>2116</code></td>
+  </tr>
   <tr>
     <td>Kyocera</td>
-    <td><code>0482</code></td></tr>
+    <td><code>0482</code></td>
+  </tr>
   <tr>
     <td>Lenevo</td>
-    <td><code>17EF</code></td></tr>
+    <td><code>17EF</code></td>
+  </tr>
   <tr>
     <td>LG</td>
-    <td><code>1004</code></td></tr>
+    <td><code>1004</code></td>
+  </tr>
   <tr>
     <td>Motorola</td>
-    <td><code>22b8</code></td></tr>
+    <td><code>22B8</code></td>
+  </tr>
+  <tr>
+    <td>NEC</td>
+    <td><code>0409</code></td>
+  </tr>
+  <tr>
+    <td>Nook</td>
+    <td><code>2080</code></td>
+  </tr>
   <tr>
     <td>Nvidia</td>
-    <td><code>0955</code></td></tr>
+    <td><code>0955</code></td>
+  </tr>
+  <tr>
+    <td>OTGV</td>
+    <td><code>2257</code></td>
+  </tr>
   <tr>
     <td>Pantech</td>
-    <td><code>10A9</code></td></tr>
+    <td><code>10A9</code></td>
+  </tr>
+  <tr>
+    <td>Pegatron</td>
+    <td><code>1D4D</code></td>
+  </tr>
+  <tr>
+    <td>Philips</td>
+    <td><code>0471</code></td>
+  </tr>
+  <tr>
+    <td>PMC-Sierra</td>
+    <td><code>04DA</code></td>
+  </tr>
+  <tr>
+    <td>Qualcomm</td>
+    <td><code>05C6</code></td>
+  </tr>
+  <tr>
+    <td>SK Telesys</td>
+    <td><code>1F53</code></td>
+  </tr>
   <tr>
     <td>Samsung</td>
-    <td><code>04e8</code></td></tr>
+    <td><code>04E8</code></td>
+  </tr>
   <tr>
     <td>Sharp</td>
-    <td><code>04dd</code></td></tr>
+    <td><code>04DD</code></td>
+  </tr>
   <tr>
     <td>Sony Ericsson</td>
-    <td><code>0fce</code></td></tr>
+    <td><code>0FCE</code></td>
+  </tr>
+  <tr>
+    <td>Toshiba</td>
+    <td><code>0930</code></td>
+  </tr>
   <tr>
     <td>ZTE</td>
-    <td><code>19D2</code></td></tr>
+    <td><code>19D2</code></td>
+  </tr>
 </table>
diff --git a/docs/html/sdk/oem-usb.jd b/docs/html/sdk/oem-usb.jd
index 3c2ba8b..ad3be4a 100644
--- a/docs/html/sdk/oem-usb.jd
+++ b/docs/html/sdk/oem-usb.jd
@@ -92,6 +92,8 @@
 href="http://developer.motorola.com/docstools/USB_Drivers/">http://developer.motorola.com/docstools/USB_Drivers/</a></td>
 </tr><tr><td>Pantech</td>	<td><a
 href="http://www.isky.co.kr/cs/software/software.sky?fromUrl=index">http://www.isky.co.kr/cs/software/software.sky?fromUrl=index</a></td>
+</tr><tr><td>Pegatron</td>	<td><a
+href="http://www.pegatroncorp.com/download/New_Duke_PC_Driver_0705.zip">http://www.pegatroncorp.com/download/New_Duke_PC_Driver_0705.zip</a> (ZIP download)</td>
 </tr><tr><td>Samsung</td>	<td><a
 href="http://www.samsung.com/us/support/downloads">http://www.samsung.com/us/support/downloads</a></td>
 </tr><tr><td>Sharp</td>	<td><a
diff --git a/include/media/stagefright/foundation/ALooperRoster.h b/include/media/stagefright/foundation/ALooperRoster.h
index c1bd4ed..2e5fd73 100644
--- a/include/media/stagefright/foundation/ALooperRoster.h
+++ b/include/media/stagefright/foundation/ALooperRoster.h
@@ -31,9 +31,14 @@
 
     void unregisterHandler(ALooper::handler_id handlerID);
 
-    void postMessage(const sp<AMessage> &msg, int64_t delayUs = 0);
+    status_t postMessage(const sp<AMessage> &msg, int64_t delayUs = 0);
     void deliverMessage(const sp<AMessage> &msg);
 
+    status_t postAndAwaitResponse(
+            const sp<AMessage> &msg, sp<AMessage> *response);
+
+    void postReply(uint32_t replyID, const sp<AMessage> &reply);
+
     sp<ALooper> findLooper(ALooper::handler_id handlerID);
 
 private:
@@ -45,6 +50,12 @@
     Mutex mLock;
     KeyedVector<ALooper::handler_id, HandlerInfo> mHandlers;
     ALooper::handler_id mNextHandlerID;
+    uint32_t mNextReplyID;
+    Condition mRepliesCondition;
+
+    KeyedVector<uint32_t, sp<AMessage> > mReplies;
+
+    status_t postMessage_l(const sp<AMessage> &msg, int64_t delayUs);
 
     DISALLOW_EVIL_CONSTRUCTORS(ALooperRoster);
 };
diff --git a/include/media/stagefright/foundation/AMessage.h b/include/media/stagefright/foundation/AMessage.h
index 72dc730..7ec54aa 100644
--- a/include/media/stagefright/foundation/AMessage.h
+++ b/include/media/stagefright/foundation/AMessage.h
@@ -72,6 +72,17 @@
 
     void post(int64_t delayUs = 0);
 
+    // Posts the message to its target and waits for a response (or error)
+    // before returning.
+    status_t postAndAwaitResponse(sp<AMessage> *response);
+
+    // If this returns true, the sender of this message is synchronously
+    // awaiting a response, the "replyID" can be used to send the response
+    // via "postReply" below.
+    bool senderAwaitsResponse(uint32_t *replyID) const;
+
+    void postReply(uint32_t replyID);
+
     // Performs a deep-copy of "this", contained messages are in turn "dup'ed".
     // Warning: RefBase items, i.e. "objects" are _not_ copied but only have
     // their refcount incremented.
diff --git a/media/java/android/media/RemoteControlClient.java b/media/java/android/media/RemoteControlClient.java
index e6331ce..2bdd3c9 100644
--- a/media/java/android/media/RemoteControlClient.java
+++ b/media/java/android/media/RemoteControlClient.java
@@ -722,20 +722,22 @@
      */
 
     private Bitmap scaleBitmapIfTooBig(Bitmap bitmap, int maxWidth, int maxHeight) {
-        final int width = bitmap.getWidth();
-        final int height = bitmap.getHeight();
-        if (width > maxWidth || height > maxHeight) {
-            float scale = Math.min((float) maxWidth / width, (float) maxHeight / height);
-            int newWidth = Math.round(scale * width);
-            int newHeight = Math.round(scale * height);
-            Bitmap outBitmap = Bitmap.createBitmap(newWidth, newHeight, bitmap.getConfig());
-            Canvas canvas = new Canvas(outBitmap);
-            Paint paint = new Paint();
-            paint.setAntiAlias(true);
-            paint.setFilterBitmap(true);
-            canvas.drawBitmap(bitmap, null,
-                    new RectF(0, 0, outBitmap.getWidth(), outBitmap.getHeight()), paint);
-            bitmap = outBitmap;
+        if (bitmap != null) {
+            final int width = bitmap.getWidth();
+            final int height = bitmap.getHeight();
+            if (width > maxWidth || height > maxHeight) {
+                float scale = Math.min((float) maxWidth / width, (float) maxHeight / height);
+                int newWidth = Math.round(scale * width);
+                int newHeight = Math.round(scale * height);
+                Bitmap outBitmap = Bitmap.createBitmap(newWidth, newHeight, bitmap.getConfig());
+                Canvas canvas = new Canvas(outBitmap);
+                Paint paint = new Paint();
+                paint.setAntiAlias(true);
+                paint.setFilterBitmap(true);
+                canvas.drawBitmap(bitmap, null,
+                        new RectF(0, 0, outBitmap.getWidth(), outBitmap.getHeight()), paint);
+                bitmap = outBitmap;
+            }
         }
         return bitmap;
 
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp
index dd69e6b..d41ab1b 100644
--- a/media/libstagefright/AudioPlayer.cpp
+++ b/media/libstagefright/AudioPlayer.cpp
@@ -180,6 +180,8 @@
         } else {
             mAudioTrack->stop();
         }
+
+        mNumFramesPlayed = 0;
     } else {
         if (mAudioSink.get() != NULL) {
             mAudioSink->pause();
diff --git a/media/libstagefright/foundation/ALooperRoster.cpp b/media/libstagefright/foundation/ALooperRoster.cpp
index 8aa1b15..e399f2f 100644
--- a/media/libstagefright/foundation/ALooperRoster.cpp
+++ b/media/libstagefright/foundation/ALooperRoster.cpp
@@ -27,7 +27,8 @@
 namespace android {
 
 ALooperRoster::ALooperRoster()
-    : mNextHandlerID(1) {
+    : mNextHandlerID(1),
+      mNextReplyID(1) {
 }
 
 ALooper::handler_id ALooperRoster::registerHandler(
@@ -70,15 +71,19 @@
     mHandlers.removeItemsAt(index);
 }
 
-void ALooperRoster::postMessage(
+status_t ALooperRoster::postMessage(
         const sp<AMessage> &msg, int64_t delayUs) {
     Mutex::Autolock autoLock(mLock);
+    return postMessage_l(msg, delayUs);
+}
 
+status_t ALooperRoster::postMessage_l(
+        const sp<AMessage> &msg, int64_t delayUs) {
     ssize_t index = mHandlers.indexOfKey(msg->target());
 
     if (index < 0) {
         LOGW("failed to post message. Target handler not registered.");
-        return;
+        return -ENOENT;
     }
 
     const HandlerInfo &info = mHandlers.valueAt(index);
@@ -91,10 +96,12 @@
              msg->target());
 
         mHandlers.removeItemsAt(index);
-        return;
+        return -ENOENT;
     }
 
     looper->post(msg, delayUs);
+
+    return OK;
 }
 
 void ALooperRoster::deliverMessage(const sp<AMessage> &msg) {
@@ -145,4 +152,38 @@
     return looper;
 }
 
+status_t ALooperRoster::postAndAwaitResponse(
+        const sp<AMessage> &msg, sp<AMessage> *response) {
+    Mutex::Autolock autoLock(mLock);
+
+    uint32_t replyID = mNextReplyID++;
+
+    msg->setInt32("replyID", replyID);
+
+    status_t err = postMessage_l(msg, 0 /* delayUs */);
+
+    if (err != OK) {
+        response->clear();
+        return err;
+    }
+
+    ssize_t index;
+    while ((index = mReplies.indexOfKey(replyID)) < 0) {
+        mRepliesCondition.wait(mLock);
+    }
+
+    *response = mReplies.valueAt(index);
+    mReplies.removeItemsAt(index);
+
+    return OK;
+}
+
+void ALooperRoster::postReply(uint32_t replyID, const sp<AMessage> &reply) {
+    Mutex::Autolock autoLock(mLock);
+
+    CHECK(mReplies.indexOfKey(replyID) < 0);
+    mReplies.add(replyID, reply);
+    mRepliesCondition.broadcast();
+}
+
 }  // namespace android
diff --git a/media/libstagefright/foundation/AMessage.cpp b/media/libstagefright/foundation/AMessage.cpp
index b592c3f..582bdba 100644
--- a/media/libstagefright/foundation/AMessage.cpp
+++ b/media/libstagefright/foundation/AMessage.cpp
@@ -27,6 +27,8 @@
 
 namespace android {
 
+extern ALooperRoster gLooperRoster;
+
 AMessage::AMessage(uint32_t what, ALooper::handler_id target)
     : mWhat(what),
       mTarget(target),
@@ -227,11 +229,30 @@
 }
 
 void AMessage::post(int64_t delayUs) {
-    extern ALooperRoster gLooperRoster;
-
     gLooperRoster.postMessage(this, delayUs);
 }
 
+status_t AMessage::postAndAwaitResponse(sp<AMessage> *response) {
+    return gLooperRoster.postAndAwaitResponse(this, response);
+}
+
+void AMessage::postReply(uint32_t replyID) {
+    gLooperRoster.postReply(replyID, this);
+}
+
+bool AMessage::senderAwaitsResponse(uint32_t *replyID) const {
+    int32_t tmp;
+    bool found = findInt32("replyID", &tmp);
+
+    if (!found) {
+        return false;
+    }
+
+    *replyID = static_cast<uint32_t>(tmp);
+
+    return true;
+}
+
 sp<AMessage> AMessage::dup() const {
     sp<AMessage> msg = new AMessage(mWhat, mTarget);
     msg->mNumItems = mNumItems;
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_highlight.png b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_highlight.png
index 5736d46..d7a591c 100644
--- a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_highlight.png
+++ b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_highlight.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_ime_default.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_ime_default.png
index 1a9d88c..47f0745c 100644
--- a/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_ime_default.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_ime_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_ime_pressed.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_ime_pressed.png
index a6d7507..490504e 100644
--- a/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_ime_pressed.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_ime_pressed.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_default.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_default.png
index 1e1324a..348afb5 100644
--- a/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_default.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_pressed.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_pressed.png
index e4e13c5..2f20d67 100644
--- a/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_pressed.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_pressed.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-xhdpi/ic_sysbar_ime_default.png b/packages/SystemUI/res/drawable-sw600dp-xhdpi/ic_sysbar_ime_default.png
new file mode 100644
index 0000000..d670177
--- /dev/null
+++ b/packages/SystemUI/res/drawable-sw600dp-xhdpi/ic_sysbar_ime_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-xhdpi/ic_sysbar_ime_pressed.png b/packages/SystemUI/res/drawable-sw600dp-xhdpi/ic_sysbar_ime_pressed.png
new file mode 100644
index 0000000..c9f0302
--- /dev/null
+++ b/packages/SystemUI/res/drawable-sw600dp-xhdpi/ic_sysbar_ime_pressed.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-xhdpi/ic_sysbar_zoom_default.png b/packages/SystemUI/res/drawable-sw600dp-xhdpi/ic_sysbar_zoom_default.png
new file mode 100644
index 0000000..dd8c498
--- /dev/null
+++ b/packages/SystemUI/res/drawable-sw600dp-xhdpi/ic_sysbar_zoom_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-xhdpi/ic_sysbar_zoom_pressed.png b/packages/SystemUI/res/drawable-sw600dp-xhdpi/ic_sysbar_zoom_pressed.png
new file mode 100644
index 0000000..dc42157
--- /dev/null
+++ b/packages/SystemUI/res/drawable-sw600dp-xhdpi/ic_sysbar_zoom_pressed.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back.png
index 4cb305d..16c5ca1 100644
--- a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back.png
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back_ime_pressed.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back_ime_pressed.png
new file mode 100644
index 0000000..3e59c8d
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back_ime_pressed.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back_land.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back_land.png
index 85df060..c13abf0 100644
--- a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back_land.png
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_highlight_land.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_highlight_land.png
index 97a07fa..3c4ce69 100644
--- a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_highlight_land.png
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_highlight_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_home.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_home.png
index 31d35c8..16ea9f6a 100644
--- a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_home.png
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_home.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_home_land.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_home_land.png
index 334213b..1f76128 100644
--- a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_home_land.png
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_home_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu.png
index 7c21c48..b7f6c11 100644
--- a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu.png
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu_land.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu_land.png
index 1fe6b91..a5d3c6a 100644
--- a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu_land.png
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_recent.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_recent.png
index f0cc341d..ad26f6c 100644
--- a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_recent.png
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_recent.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_recent_land.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_recent_land.png
index 7e8504c..39fc827 100644
--- a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_recent_land.png
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_recent_land.png
Binary files differ
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index dd59667..2ab667d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -879,12 +879,11 @@
             removeNotificationViews(key);
             addNotificationViews(key, notification);
         }
-        // fullScreenIntent doesn't happen on updates.  You need to clear & repost a new
-        // notification.
-        final boolean immersive = isImmersive();
-        if (false && immersive) {
-            // TODO: immersive mode
-        } else {
+
+        // Restart the ticker if it's still running
+        if (notification.notification.tickerText != null
+                && !TextUtils.equals(notification.notification.tickerText,
+                    oldEntry.notification.notification.tickerText)) {
             tick(key, notification, false);
         }
 
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index e72d09f..85d8cece 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -16,6 +16,7 @@
 
 package com.android.server;
 
+import static android.Manifest.permission.DUMP;
 import static android.Manifest.permission.MANAGE_NETWORK_POLICY;
 import static android.net.NetworkStats.IFACE_ALL;
 import static android.net.NetworkStats.SET_DEFAULT;
@@ -51,10 +52,12 @@
 import java.io.BufferedReader;
 import java.io.DataInputStream;
 import java.io.File;
+import java.io.FileDescriptor;
 import java.io.FileInputStream;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.io.PrintWriter;
 import java.net.Inet4Address;
 import java.net.InetAddress;
 import java.util.ArrayList;
@@ -288,7 +291,6 @@
         for (INetworkManagementEventObserver obs : mObservers) {
             try {
                 obs.limitReached(limitName, iface);
-                Slog.d(TAG, "Observer notified limit reached for " + limitName + " " + iface);
             } catch (Exception ex) {
                 Slog.w(TAG, "Observer notifier failed", ex);
             }
@@ -1031,7 +1033,6 @@
         final NetworkStats stats = new NetworkStats(SystemClock.elapsedRealtime(), 6);
         final NetworkStats.Entry entry = new NetworkStats.Entry();
 
-        final HashSet<String> activeIfaces = Sets.newHashSet();
         final ArrayList<String> values = Lists.newArrayList();
 
         BufferedReader reader = null;
@@ -1057,7 +1058,6 @@
                     entry.txBytes = Long.parseLong(values.get(9));
                     entry.txPackets = Long.parseLong(values.get(10));
 
-                    activeIfaces.add(entry.iface);
                     stats.addValues(entry);
                 } catch (NumberFormatException e) {
                     Slog.w(TAG, "problem parsing stats row '" + line + "': " + e);
@@ -1073,14 +1073,9 @@
             IoUtils.closeQuietly(reader);
         }
 
-        if (DBG) Slog.d(TAG, "recorded active stats from " + activeIfaces);
-
-        // splice in stats from any disabled ifaces
+        // splice in historical stats not reflected in mStatsIface
         if (mBandwidthControlEnabled) {
-            final HashSet<String> xtIfaces = Sets.newHashSet(fileListWithoutNull(mStatsXtIface));
-            xtIfaces.removeAll(activeIfaces);
-
-            for (String iface : xtIfaces) {
+            for (String iface : fileListWithoutNull(mStatsXtIface)) {
                 final File ifacePath = new File(mStatsXtIface, iface);
 
                 entry.iface = iface;
@@ -1092,10 +1087,8 @@
                 entry.txBytes = readSingleLongFromFile(new File(ifacePath, "tx_bytes"));
                 entry.txPackets = readSingleLongFromFile(new File(ifacePath, "tx_packets"));
 
-                stats.addValues(entry);
+                stats.combineValues(entry);
             }
-
-            if (DBG) Slog.d(TAG, "recorded stale stats from " + xtIfaces);
         }
 
         return stats;
@@ -1583,4 +1576,26 @@
             mConnector.monitor();
         }
     }
+
+    @Override
+    protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+        mContext.enforceCallingOrSelfPermission(DUMP, TAG);
+
+        pw.print("Bandwidth control enabled: "); pw.println(mBandwidthControlEnabled);
+
+        synchronized (mQuotaLock) {
+            pw.print("Active quota ifaces: "); pw.println(mActiveQuotaIfaces.toString());
+            pw.print("Active alert ifaces: "); pw.println(mActiveAlertIfaces.toString());
+        }
+
+        synchronized (mUidRejectOnQuota) {
+            pw.print("UID reject on quota ifaces: [");
+            final int size = mUidRejectOnQuota.size();
+            for (int i = 0; i < size; i++) {
+                pw.print(mUidRejectOnQuota.keyAt(i));
+                if (i < size - 1) pw.print(",");
+            }
+            pw.println("]");
+        }
+    }
 }
diff --git a/services/java/com/android/server/net/NetworkPolicyManagerService.java b/services/java/com/android/server/net/NetworkPolicyManagerService.java
index 84e5eae..77f53c2 100644
--- a/services/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -133,6 +133,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 
 import libcore.io.IoUtils;
 
@@ -766,9 +767,6 @@
                     && totalBytes > policy.limitBytes && policy.lastSnooze < start;
             final boolean enabled = !overLimit;
 
-            if (LOGD) {
-                Slog.d(TAG, "setting template=" + policy.template + " enabled=" + enabled);
-            }
             setNetworkTemplateEnabled(policy.template, enabled);
         }
     }
@@ -835,9 +833,10 @@
 
             // collect all active ifaces that match this template
             ifaceList.clear();
-            for (NetworkIdentity ident : networks.keySet()) {
+            for (Map.Entry<NetworkIdentity, String> entry : networks.entrySet()) {
+                final NetworkIdentity ident = entry.getKey();
                 if (policy.template.matches(ident)) {
-                    final String iface = networks.get(ident);
+                    final String iface = entry.getValue();
                     ifaceList.add(iface);
                 }
             }
diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java
index 80ae9bc..bb0a0d1 100644
--- a/services/java/com/android/server/net/NetworkStatsService.java
+++ b/services/java/com/android/server/net/NetworkStatsService.java
@@ -707,7 +707,7 @@
                     mLastPersistUidSnapshot, uidSnapshot, true);
             if (forcePersist || persistUidDelta.getTotalBytes() > persistThreshold) {
                 writeUidStatsLocked();
-                mLastPersistNetworkSnapshot = networkSnapshot;
+                mLastPersistUidSnapshot = networkSnapshot;
             }
         }
 
diff --git a/services/tests/servicestests/src/com/android/server/NetworkManagementServiceTest.java b/services/tests/servicestests/src/com/android/server/NetworkManagementServiceTest.java
index 5f35697..ecf78d9 100644
--- a/services/tests/servicestests/src/com/android/server/NetworkManagementServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/NetworkManagementServiceTest.java
@@ -117,6 +117,18 @@
         assertStatsEntry(stats, "wlan0", UID_ALL, SET_DEFAULT, TAG_NONE, 1024L, 2048L);
     }
 
+    public void testNetworkStatsCombined() throws Exception {
+        stageFile(R.raw.net_dev_typical, new File(mTestProc, "net/dev"));
+        stageLong(10L, new File(mTestProc, "net/xt_qtaguid/iface_stat/rmnet0/rx_bytes"));
+        stageLong(20L, new File(mTestProc, "net/xt_qtaguid/iface_stat/rmnet0/rx_packets"));
+        stageLong(30L, new File(mTestProc, "net/xt_qtaguid/iface_stat/rmnet0/tx_bytes"));
+        stageLong(40L, new File(mTestProc, "net/xt_qtaguid/iface_stat/rmnet0/tx_packets"));
+
+        final NetworkStats stats = mService.getNetworkStatsSummary();
+        assertStatsEntry(stats, "rmnet0", UID_ALL, SET_DEFAULT, TAG_NONE, 1507570L + 10L,
+                2205L + 20L, 489339L + 30L, 2237L + 40L);
+    }
+
     public void testKernelTags() throws Exception {
         assertEquals("0", tagToKernel(0x0));
         assertEquals("214748364800", tagToKernel(0x32));
diff --git a/tests/BiDiTests/res/layout/basic.xml b/tests/BiDiTests/res/layout/basic.xml
index 8a27213..f503658 100644
--- a/tests/BiDiTests/res/layout/basic.xml
+++ b/tests/BiDiTests/res/layout/basic.xml
@@ -27,11 +27,18 @@
                       android:layout_width="match_parent"
                       android:layout_height="wrap_content">
 
-            <Button android:id="@+id/button"
+            <TextView android:id="@+id/textview_password_default"
                     android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
-                    android:text="@string/button_text"
                     android:textSize="32dip"
+                    android:text="@string/textview_password_default_text"
+            />
+
+            <EditText android:id="@+id/edittext_password_default"
+                      android:layout_height="wrap_content"
+                      android:layout_width="match_parent"
+                      android:textSize="32dip"
+                      android:password="true"
                     />
 
             <TextView android:id="@+id/textview_default"
diff --git a/tests/BiDiTests/res/values/strings.xml b/tests/BiDiTests/res/values/strings.xml
index b0809da..b1f5e50e 100644
--- a/tests/BiDiTests/res/values/strings.xml
+++ b/tests/BiDiTests/res/values/strings.xml
@@ -28,6 +28,7 @@
     <string name="textview_ltr_text">This is a text for a LTR TextView</string>
     <string name="textview_rtl_text">This is a text for a RTL TextView</string>
     <string name="textview_default_text">This is a text for a default TextView</string>
+    <string name="textview_password_default_text">This is a text for a password TextView</string>
     <string name="edittext_text">mmmmmmmmmmmmmmmmmmmmmmmm</string>
     <string name="normal_text">Normal String</string>
     <string name="normal_long_text">mmmmmmmmmmmmmmmmmmmmmmmm</string>
diff --git a/wifi/java/android/net/wifi/WifiConfigStore.java b/wifi/java/android/net/wifi/WifiConfigStore.java
index 45c9869..83dda5c 100644
--- a/wifi/java/android/net/wifi/WifiConfigStore.java
+++ b/wifi/java/android/net/wifi/WifiConfigStore.java
@@ -376,7 +376,8 @@
         boolean ret = WifiNative.disableNetworkCommand(netId);
         synchronized (sConfiguredNetworks) {
             WifiConfiguration config = sConfiguredNetworks.get(netId);
-            if (config != null) {
+            /* Only change the reason if the network was not previously disabled */
+            if (config != null && config.status != Status.DISABLED) {
                 config.status = Status.DISABLED;
                 config.disableReason = reason;
             }
@@ -610,7 +611,10 @@
         synchronized (sConfiguredNetworks) {
             for(WifiConfiguration config : sConfiguredNetworks.values()) {
                 if(config != null && config.networkId != netId) {
-                    config.status = Status.DISABLED;
+                    if (config.status != Status.DISABLED) {
+                        config.status = Status.DISABLED;
+                        config.disableReason = WifiConfiguration.DISABLED_UNKNOWN_REASON;
+                    }
                 }
             }
         }
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index d2a0b30..85a6f27 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -530,6 +530,7 @@
         if (source != null) {
             networkId = source.networkId;
             status = source.status;
+            disableReason = source.disableReason;
             SSID = source.SSID;
             BSSID = source.BSSID;
             preSharedKey = source.preSharedKey;