Merge "Update dev guide for new build system and new lib system."
diff --git a/api/14.txt b/api/14.txt
index e26311f..92969f6 100644
--- a/api/14.txt
+++ b/api/14.txt
@@ -11541,7 +11541,6 @@
 
   public class ConnectivityManager {
     method public android.net.NetworkInfo getActiveNetworkInfo();
-    method public android.net.NetworkQuotaInfo getActiveNetworkQuotaInfo();
     method public android.net.NetworkInfo[] getAllNetworkInfo();
     method public deprecated boolean getBackgroundDataSetting();
     method public android.net.NetworkInfo getNetworkInfo(int);
@@ -11701,16 +11700,6 @@
     enum_constant public static final android.net.NetworkInfo.State UNKNOWN;
   }
 
-  public class NetworkQuotaInfo implements android.os.Parcelable {
-    method public int describeContents();
-    method public long getEstimatedBytes();
-    method public long getHardLimitBytes();
-    method public long getSoftLimitBytes();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator CREATOR;
-    field public static final long NO_LIMIT = -1L; // 0xffffffffffffffffL
-  }
-
   public class ParseException extends java.lang.RuntimeException {
     field public java.lang.String response;
   }
diff --git a/api/current.txt b/api/current.txt
index e26311f..92969f6 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -11541,7 +11541,6 @@
 
   public class ConnectivityManager {
     method public android.net.NetworkInfo getActiveNetworkInfo();
-    method public android.net.NetworkQuotaInfo getActiveNetworkQuotaInfo();
     method public android.net.NetworkInfo[] getAllNetworkInfo();
     method public deprecated boolean getBackgroundDataSetting();
     method public android.net.NetworkInfo getNetworkInfo(int);
@@ -11701,16 +11700,6 @@
     enum_constant public static final android.net.NetworkInfo.State UNKNOWN;
   }
 
-  public class NetworkQuotaInfo implements android.os.Parcelable {
-    method public int describeContents();
-    method public long getEstimatedBytes();
-    method public long getHardLimitBytes();
-    method public long getSoftLimitBytes();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator CREATOR;
-    field public static final long NO_LIMIT = -1L; // 0xffffffffffffffffL
-  }
-
   public class ParseException extends java.lang.RuntimeException {
     field public java.lang.String response;
   }
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index 530122c..e2d5af0 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -548,6 +548,8 @@
      * Return quota status for the current active network, or {@code null} if no
      * network is active. Quota status can change rapidly, so these values
      * shouldn't be cached.
+     *
+     * @hide
      */
     public NetworkQuotaInfo getActiveNetworkQuotaInfo() {
         try {
diff --git a/core/java/android/net/NetworkQuotaInfo.java b/core/java/android/net/NetworkQuotaInfo.java
index b85f925..6535256 100644
--- a/core/java/android/net/NetworkQuotaInfo.java
+++ b/core/java/android/net/NetworkQuotaInfo.java
@@ -21,6 +21,8 @@
 
 /**
  * Information about quota status on a specific network.
+ *
+ * @hide
  */
 public class NetworkQuotaInfo implements Parcelable {
     private final long mEstimatedBytes;
diff --git a/core/java/android/net/http/SslError.java b/core/java/android/net/http/SslError.java
index 5998f5f..863304c 100644
--- a/core/java/android/net/http/SslError.java
+++ b/core/java/android/net/http/SslError.java
@@ -198,7 +198,8 @@
 
     /**
      * Gets the most severe SSL error in this object's set of errors.
-     * @return The most severe SSL error.
+     * Returns -1 if the set is empty.
+     * @return The most severe SSL error, or -1 if the set is empty.
      */
     public int getPrimaryError() {
         if (mErrors != 0) {
@@ -208,9 +209,11 @@
                     return error;
                 }
             }
+            // mErrors should never be set to an invalid value.
+            assert false;
         }
 
-        return 0;
+        return -1;
     }
 
     /**
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index 23d1b0f..b86d21d 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -184,6 +184,22 @@
     abstract void setup(int width, int height);
 
     /**
+     * Gets the current width of the surface. This is the width that the surface
+     * was last set to in a call to {@link #setup(int, int)}.
+     *
+     * @return the current width of the surface
+     */
+    abstract int getWidth();
+
+    /**
+     * Gets the current height of the surface. This is the height that the surface
+     * was last set to in a call to {@link #setup(int, int)}.
+     *
+     * @return the current width of the surface
+     */
+    abstract int getHeight();
+
+    /**
      * Interface used to receive callbacks whenever a view is drawn by
      * a hardware renderer instance.
      */
@@ -362,6 +378,7 @@
         static EGLDisplay sEglDisplay;
         static EGLConfig sEglConfig;
         static final Object[] sEglLock = new Object[0];
+        int mWidth = -1, mHeight = -1;
 
         static final ThreadLocal<EGLContext> sEglContextStorage = new ThreadLocal<EGLContext>();
 
@@ -714,9 +731,21 @@
         void setup(int width, int height) {
             if (validate()) {
                 mCanvas.setViewport(width, height);
+                mWidth = width;
+                mHeight = height;
             }
         }
 
+        @Override
+        int getWidth() {
+            return mWidth;
+        }
+
+        @Override
+        int getHeight() {
+            return mHeight;
+        }
+
         boolean canDraw() {
             return mGl != null && mCanvas != null;
         }        
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index e7c91f9..615a5f6 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -860,7 +860,6 @@
         CompatibilityInfo compatibilityInfo = mCompatibilityInfo.get();
         if (compatibilityInfo.supportsScreen() == mLastInCompatMode) {
             params = lp;
-            windowAttributesChanges |= WindowManager.LayoutParams.BUFFER_CHANGED;
             fullRedrawNeeded = true;
             mLayoutRequested = true;
             if (mLastInCompatMode) {
@@ -1078,7 +1077,6 @@
                             ~WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST) |
                             resizeMode;
                     params = lp;
-                    windowAttributesChanges |= WindowManager.LayoutParams.BUFFER_CHANGED;
                 }
             }
         }
@@ -1375,13 +1373,15 @@
                 }
             }
 
-            if (hwInitialized || ((windowShouldResize || (params != null &&
-                    (windowAttributesChanges & WindowManager.LayoutParams.BUFFER_CHANGED) != 0)) &&
-                    mAttachInfo.mHardwareRenderer != null &&
-                    mAttachInfo.mHardwareRenderer.isEnabled())) {
-                mAttachInfo.mHardwareRenderer.setup(mWidth, mHeight);
-                if (!hwInitialized && mAttachInfo.mHardwareRenderer.isEnabled()) {
-                    mAttachInfo.mHardwareRenderer.invalidate(mHolder);
+            if (mAttachInfo.mHardwareRenderer != null &&
+                    mAttachInfo.mHardwareRenderer.isEnabled()) {
+                if (hwInitialized || windowShouldResize ||
+                        mWidth != mAttachInfo.mHardwareRenderer.getWidth() ||
+                        mHeight != mAttachInfo.mHardwareRenderer.getHeight()) {
+                    mAttachInfo.mHardwareRenderer.setup(mWidth, mHeight);
+                    if (!hwInitialized) {
+                        mAttachInfo.mHardwareRenderer.invalidate(mHolder);
+                    }
                 }
             }
 
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 17a516c..99acb3f 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -1260,8 +1260,6 @@
         /** {@hide} */
         public static final int PRIVATE_FLAGS_CHANGED = 1<<16;
         /** {@hide} */
-        public static final int BUFFER_CHANGED = 1<<17;
-        /** {@hide} */
         public static final int EVERYTHING_CHANGED = 0xffffffff;
 
         // internal buffer to backup/restore parameters under compatibility mode.
@@ -1272,11 +1270,11 @@
     
             if (width != o.width) {
                 width = o.width;
-                changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
+                changes |= LAYOUT_CHANGED;
             }
             if (height != o.height) {
                 height = o.height;
-                changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
+                changes |= LAYOUT_CHANGED;
             }
             if (x != o.x) {
                 x = o.x;
@@ -1288,19 +1286,19 @@
             }
             if (horizontalWeight != o.horizontalWeight) {
                 horizontalWeight = o.horizontalWeight;
-                changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
+                changes |= LAYOUT_CHANGED;
             }
             if (verticalWeight != o.verticalWeight) {
                 verticalWeight = o.verticalWeight;
-                changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
+                changes |= LAYOUT_CHANGED;
             }
             if (horizontalMargin != o.horizontalMargin) {
                 horizontalMargin = o.horizontalMargin;
-                changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
+                changes |= LAYOUT_CHANGED;
             }
             if (verticalMargin != o.verticalMargin) {
                 verticalMargin = o.verticalMargin;
-                changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
+                changes |= LAYOUT_CHANGED;
             }
             if (type != o.type) {
                 type = o.type;
@@ -1308,7 +1306,7 @@
             }
             if (flags != o.flags) {
                 flags = o.flags;
-                changes |= FLAGS_CHANGED | BUFFER_CHANGED;
+                changes |= FLAGS_CHANGED;
             }
             if (privateFlags != o.privateFlags) {
                 privateFlags = o.privateFlags;
@@ -1320,11 +1318,11 @@
             }
             if (gravity != o.gravity) {
                 gravity = o.gravity;
-                changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
+                changes |= LAYOUT_CHANGED;
             }
             if (format != o.format) {
                 format = o.format;
-                changes |= FORMAT_CHANGED | BUFFER_CHANGED;
+                changes |= FORMAT_CHANGED;
             }
             if (windowAnimations != o.windowAnimations) {
                 windowAnimations = o.windowAnimations;
@@ -1363,7 +1361,7 @@
     
             if (screenOrientation != o.screenOrientation) {
                 screenOrientation = o.screenOrientation;
-                changes |= SCREEN_ORIENTATION_CHANGED | BUFFER_CHANGED;
+                changes |= SCREEN_ORIENTATION_CHANGED;
             }
 
             if (systemUiVisibility != o.systemUiVisibility
diff --git a/core/java/android/webkit/SslErrorHandlerImpl.java b/core/java/android/webkit/SslErrorHandlerImpl.java
index 82cd3e8..b2e4b13 100644
--- a/core/java/android/webkit/SslErrorHandlerImpl.java
+++ b/core/java/android/webkit/SslErrorHandlerImpl.java
@@ -159,7 +159,7 @@
 
         if (DebugFlags.SSL_ERROR_HANDLER) {
             assert host != null;
-            assert primary != 0;
+            assert primary != -1;
         }
 
         if (mSslPrefTable.containsKey(host) && primary <= mSslPrefTable.getInt(host)) {
@@ -260,7 +260,7 @@
 
                 if (DebugFlags.SSL_ERROR_HANDLER) {
                     assert host != null;
-                    assert primary != 0;
+                    assert primary != -1;
                 }
                 boolean hasKey = mSslPrefTable.containsKey(host);
                 if (!hasKey || primary > mSslPrefTable.getInt(host)) {
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index 33f84a5..66371f5 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -832,7 +832,7 @@
             TextView tv =
                     (TextView) super.getView(position, convertView, parent);
             if (tv != null && mTextView != null) {
-                tv.setTextSize(mTextView.getTextSize());
+                tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextView.getTextSize());
             }
             return tv;
         }
@@ -896,7 +896,10 @@
      *          WebTextView represents.
      */
     /* package */ void setNodePointer(int ptr) {
-        mNodePointer = ptr;
+        if (ptr != mNodePointer) {
+            mNodePointer = ptr;
+            setAdapterCustom(null);
+        }
     }
 
     /**
@@ -1051,11 +1054,12 @@
         }
         setHint(null);
         setThreshold(1);
+        boolean autoComplete = false;
         if (single) {
             mWebView.requestLabel(mWebView.nativeFocusCandidateFramePointer(),
                     mNodePointer);
             maxLength = mWebView.nativeFocusCandidateMaxLength();
-            boolean autoComplete = mWebView.nativeFocusCandidateIsAutoComplete();
+            autoComplete = mWebView.nativeFocusCandidateIsAutoComplete();
             if (type != PASSWORD && (mAutoFillable || autoComplete)) {
                 String name = mWebView.nativeFocusCandidateName();
                 if (name != null && name.length() > 0) {
@@ -1070,8 +1074,9 @@
         setInputType(inputType);
         setImeOptions(imeOptions);
         setVisibility(VISIBLE);
-        AutoCompleteAdapter adapter = null;
-        setAdapterCustom(adapter);
+        if (!autoComplete) {
+            setAdapterCustom(null);
+        }
     }
 
     /**
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 89f21d7..5111969 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -3246,8 +3246,7 @@
     public void clearFormData() {
         checkThread();
         if (inEditingMode()) {
-            AutoCompleteAdapter adapter = null;
-            mWebTextView.setAdapterCustom(adapter);
+            mWebTextView.setAdapterCustom(null);
         }
     }
 
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 440ee79..ea29ad1 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -1662,24 +1662,15 @@
                 mDrawIsScheduled = false;
             }
             if (mMessages != null) {
-                Log.w(LOGTAG, "Not supported in this case.");
+                Throwable throwable = new Throwable(
+                        "EventHub.removeMessages(int what = " + what + ") is not supported " +
+                        "before the WebViewCore is set up.");
+                Log.w(LOGTAG, Log.getStackTraceString(throwable));
             } else {
                 mHandler.removeMessages(what);
             }
         }
 
-        private synchronized boolean hasMessages(int what) {
-            if (mBlockMessages) {
-                return false;
-            }
-            if (mMessages != null) {
-                Log.w(LOGTAG, "hasMessages() is not supported in this case.");
-                return false;
-            } else {
-                return mHandler.hasMessages(what);
-            }
-        }
-
         private synchronized void sendMessageDelayed(Message msg, long delay) {
             if (mBlockMessages) {
                 return;
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index adf2b7b..6df80e4 100644
--- a/core/java/android/widget/SearchView.java
+++ b/core/java/android/widget/SearchView.java
@@ -92,6 +92,11 @@
     private static final boolean DBG = false;
     private static final String LOG_TAG = "SearchView";
 
+    /**
+     * Private constant for removing the microphone in the keyboard.
+     */
+    private static final String IME_OPTION_NO_MICROPHONE = "nm";
+
     private OnQueryTextListener mOnQueryChangeListener;
     private OnCloseListener mOnCloseListener;
     private OnFocusChangeListener mOnQueryTextFocusChangeListener;
@@ -256,7 +261,7 @@
         mQueryTextView.setOnItemClickListener(mOnItemClickListener);
         mQueryTextView.setOnItemSelectedListener(mOnItemSelectedListener);
         mQueryTextView.setOnKeyListener(mTextKeyListener);
-        // Inform any listener of focus changes 
+        // Inform any listener of focus changes
         mQueryTextView.setOnFocusChangeListener(new OnFocusChangeListener() {
 
             public void onFocusChange(View v, boolean hasFocus) {
@@ -335,6 +340,12 @@
         }
         // Cache the voice search capability
         mVoiceButtonEnabled = hasVoiceSearch();
+
+        if (mVoiceButtonEnabled) {
+            // Disable the microphone on the keyboard, as a mic is displayed near the text box
+            // TODO: use imeOptions to disable voice input when the new API will be available
+            mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
+        }
         updateViewsVisibility(isIconified());
     }
 
diff --git a/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png b/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png
index 7cbff01..1c26920 100644
--- a/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png b/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png
index 7cbff01..1c26920 100644
--- a/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_control_disabled_holo.png b/core/res/res/drawable-hdpi/scrubber_control_disabled_holo.png
index d4b3209..167d7d3 100644
--- a/core/res/res/drawable-hdpi/scrubber_control_disabled_holo.png
+++ b/core/res/res/drawable-hdpi/scrubber_control_disabled_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_control_focused_holo.png b/core/res/res/drawable-hdpi/scrubber_control_focused_holo.png
index ec7303e..4048260 100644
--- a/core/res/res/drawable-hdpi/scrubber_control_focused_holo.png
+++ b/core/res/res/drawable-hdpi/scrubber_control_focused_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_control_normal_holo.png b/core/res/res/drawable-hdpi/scrubber_control_normal_holo.png
index 19526fe..90e9c9c 100644
--- a/core/res/res/drawable-hdpi/scrubber_control_normal_holo.png
+++ b/core/res/res/drawable-hdpi/scrubber_control_normal_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_control_pressed_holo.png b/core/res/res/drawable-hdpi/scrubber_control_pressed_holo.png
index e8f9eef..4a3e57c 100644
--- a/core/res/res/drawable-hdpi/scrubber_control_pressed_holo.png
+++ b/core/res/res/drawable-hdpi/scrubber_control_pressed_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png b/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png
index 31228b6..ab8ec69 100644
--- a/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png b/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png
index 31228b6..ab8ec69 100644
--- a/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_control_disabled_holo.png b/core/res/res/drawable-mdpi/scrubber_control_disabled_holo.png
index 6f58ef0..351d539 100644
--- a/core/res/res/drawable-mdpi/scrubber_control_disabled_holo.png
+++ b/core/res/res/drawable-mdpi/scrubber_control_disabled_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_control_focused_holo.png b/core/res/res/drawable-mdpi/scrubber_control_focused_holo.png
index 3d8f134..e6072ee 100644
--- a/core/res/res/drawable-mdpi/scrubber_control_focused_holo.png
+++ b/core/res/res/drawable-mdpi/scrubber_control_focused_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_control_normal_holo.png b/core/res/res/drawable-mdpi/scrubber_control_normal_holo.png
index d480c55..79682c1 100644
--- a/core/res/res/drawable-mdpi/scrubber_control_normal_holo.png
+++ b/core/res/res/drawable-mdpi/scrubber_control_normal_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_control_pressed_holo.png b/core/res/res/drawable-mdpi/scrubber_control_pressed_holo.png
index 6a414fa..ba53c0b 100644
--- a/core/res/res/drawable-mdpi/scrubber_control_pressed_holo.png
+++ b/core/res/res/drawable-mdpi/scrubber_control_pressed_holo.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progress_primary_holo_dark.9.png b/core/res/res/drawable-xhdpi/progress_primary_holo_dark.9.png
index 097160b..c6c3f1e 100644
--- a/core/res/res/drawable-xhdpi/progress_primary_holo_dark.9.png
+++ b/core/res/res/drawable-xhdpi/progress_primary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progress_primary_holo_light.9.png b/core/res/res/drawable-xhdpi/progress_primary_holo_light.9.png
index 097160b..c6c3f1e 100644
--- a/core/res/res/drawable-xhdpi/progress_primary_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/progress_primary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_control_disabled_holo.png b/core/res/res/drawable-xhdpi/scrubber_control_disabled_holo.png
index 4715cfb..8cf3868 100644
--- a/core/res/res/drawable-xhdpi/scrubber_control_disabled_holo.png
+++ b/core/res/res/drawable-xhdpi/scrubber_control_disabled_holo.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_control_focused_holo.png b/core/res/res/drawable-xhdpi/scrubber_control_focused_holo.png
index d41d5a3..417b35a 100644
--- a/core/res/res/drawable-xhdpi/scrubber_control_focused_holo.png
+++ b/core/res/res/drawable-xhdpi/scrubber_control_focused_holo.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_control_normal_holo.png b/core/res/res/drawable-xhdpi/scrubber_control_normal_holo.png
index 4f0e06d..8053d88 100644
--- a/core/res/res/drawable-xhdpi/scrubber_control_normal_holo.png
+++ b/core/res/res/drawable-xhdpi/scrubber_control_normal_holo.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_control_pressed_holo.png b/core/res/res/drawable-xhdpi/scrubber_control_pressed_holo.png
index 5d9f860..d17fa7d 100644
--- a/core/res/res/drawable-xhdpi/scrubber_control_pressed_holo.png
+++ b/core/res/res/drawable-xhdpi/scrubber_control_pressed_holo.png
Binary files differ
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index ae39760..bde2c72 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -182,6 +182,28 @@
     <!-- Regex of wired ethernet ifaces -->
     <string translatable="false" name="config_ethernet_iface_regex">eth\\d</string>
 
+    <!-- If the mobile hotspot feature requires provisioning, an intent string can be provided
+        to the launch a supported application that provisions the devices.
+
+        Example Usage:
+
+        Intent intent = new Intent(R.string.config_mobile_hotspot_provision_intent);
+        startActivityForResult(intent, 0);
+
+        public void onActivityResult(int requestCode, int resultCode, Intent intent) {
+            super.onActivityResult(requestCode, resultCode, intent);
+            if (requestCode == 0) {
+                if (resultCode == Activity.RESULT_OK) {
+                    //Mobile hotspot provisioning successful
+                } else {
+                    //Mobile hotspot provisioning failed
+                }
+            }
+
+        See src/com/android/settings/TetherSettings.java for more details.
+        -->
+    <string translatable="false" name="config_mobile_hotspot_provision_intent"></string>
+
     <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
     <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
     <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
diff --git a/docs/html/guide/topics/resources/drawable-resource.jd b/docs/html/guide/topics/resources/drawable-resource.jd
index 912b6fd..ed9f990 100644
--- a/docs/html/guide/topics/resources/drawable-resource.jd
+++ b/docs/html/guide/topics/resources/drawable-resource.jd
@@ -641,6 +641,7 @@
         android:drawable="@[package:]drawable/<em>drawable_resource</em>"
         android:state_pressed=["true" | "false"]
         android:state_focused=["true" | "false"]
+        android:state_hovered=["true" | "false"]
         android:state_selected=["true" | "false"]
         android:state_checkable=["true" | "false"]
         android:state_checked=["true" | "false"]
@@ -692,6 +693,11 @@
           <dd><em>Boolean</em>. "true" if this item should be used when the object is focused (such as when a button
 is highlighted using the trackball/d-pad); "false" if this item should be used in the default,
 non-focused state.</dd>
+        <dt><code>android:state_hovered</code></dt>
+          <dd><em>Boolean</em>. "true" if this item should be used when the object is being hovered
+by a cursor; "false" if this item should be used in the default, non-hovered state. Often, this
+drawable may be the same drawable used for the "focused" state.
+          <p>Introduced in API level 14.</p></dd>
         <dt><code>android:state_selected</code></dt>
           <dd><em>Boolean</em>. "true" if this item should be used when the object is selected (such as when a
 tab is opened); "false" if this item should be used when the object is not selected.</dd>
@@ -729,6 +735,8 @@
           android:drawable="@drawable/button_pressed" /> &lt;!-- pressed --&gt;
     &lt;item android:state_focused="true"
           android:drawable="@drawable/button_focused" /> &lt;!-- focused --&gt;
+    &lt;item android:state_hovered="true"
+          android:drawable="@drawable/button_focused" /> &lt;!-- hovered --&gt;
     &lt;item android:drawable="@drawable/button_normal" /> &lt;!-- default --&gt;
 &lt;/selector>
 </pre>
diff --git a/docs/html/guide/topics/resources/menu-resource.jd b/docs/html/guide/topics/resources/menu-resource.jd
index 64cdf21..fb7612e 100644
--- a/docs/html/guide/topics/resources/menu-resource.jd
+++ b/docs/html/guide/topics/resources/menu-resource.jd
@@ -43,9 +43,10 @@
           android:titleCondensed="<em>string</em>"
           android:icon="@[package:]drawable/<em>drawable_resource_name</em>"
           android:onClick="<em>method name</em>"
-          android:showAsAction=["ifRoom" | "never" | "withText" | "always"]
+          android:showAsAction=["ifRoom" | "never" | "withText" | "always" | "collapseActionView"]
           android:actionLayout="@[package:]layout/<em>layout_resource_name</em>"
           android:actionViewClass="<em>class name</em>"
+          android:actionProviderClass="<em>class name</em>"
           android:alphabeticShortcut="<em>string</em>"
           android:numericShortcut="<em>string</em>"
           android:checkable=["true" | "false"]
@@ -131,6 +132,9 @@
 Avoid using this unless it's critical that the item always appear in the action
 bar. Setting multiple items to always appear as action items can result in them overlapping
 with other UI in the action bar.</td></tr>
+            <tr><td><code>collapseActionView</code></td><td>The action view associated
+with this action item (as declared by <code>android:actionViewLayout</code>) is
+collapsible.<br/>Introduced in API Level 14.</td></tr>
           </table>
           <p>See the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> developer 
 guide for more information.</p>
@@ -143,9 +147,10 @@
 guide for more information.</p>
           <p>Introduced in API Level 11.</p></dd>
 
-        <dt><code>android:actionViewClassName</code></dt>
+        <dt><code>android:actionViewClass</code></dt>
           <dd><em>Class name</em>. A fully-qualified class name for the {@link android.view.View}
-to use as the action view.
+to use as the action view. For example,
+{@code "android.widget.SearchView"} to use {@link android.widget.SearchView} as an action view.
           <p>See the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> developer 
 guide for more information.</p>
           <p class="warning"><strong>Warning:</strong> If you obfuscate your code using <a
@@ -154,6 +159,17 @@
 functionality.</p>
           <p>Introduced in API Level 11.</p></dd>
 
+        <dt><code>android:actionProviderClass</code></dt>
+          <dd><em>Class name</em>. A fully-qualified class name for the {@link
+android.view.ActionProvider} to use in place of the action item. For example,
+{@code "android.widget.ShareActionProvider"} to use {@link android.widget.ShareActionProvider}.
+          <p>See the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> developer
+guide for more information.</p>
+          <p class="warning"><strong>Warning:</strong> If you obfuscate your code using <a
+href="{@docRoot}guide/developing/tools/proguard.html">ProGuard</a> (or a similar tool),
+be sure to exclude the class you specify in this attribute from renaming, because it can break the
+functionality.</p>
+          <p>Introduced in API Level 14.</p></dd>
 
         <dt><code>android:alphabeticShortcut</code></dt>
           <dd><em>Char</em>. A character for the alphabetic shortcut key.</dd>
diff --git a/docs/html/resources/resources-data.js b/docs/html/resources/resources-data.js
index 9267373..c0a2284 100644
--- a/docs/html/resources/resources-data.js
+++ b/docs/html/resources/resources-data.js
@@ -578,13 +578,13 @@
     }
   },
   {
-    tags: ['sample', 'media' ],
+    tags: ['sample', 'media', 'updated'],
     path: 'samples/RandomMusicPlayer/index.html',
     title: {
       en: 'Random Music Player'
     },
     description: {
-      en: 'Demonstrates how to write a multimedia application that plays music from the device and from URLs. It manages media playback from a service and can play music in the background, respecting audio focus changes.'
+      en: 'Demonstrates how to write a multimedia application that plays music from the device and from URLs. It manages media playback from a service and can play music in the background, respecting audio focus changes. Also shows how to use the new Remote Control APIs in API level 14.'
     }
   },
   {
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index 3b79f06..1e24599 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -1972,6 +1972,12 @@
                     sampleIndex, &syncSampleIndex, findFlags);
         }
 
+        uint32_t sampleTime;
+        if (err == OK) {
+            err = mSampleTable->getMetaDataForSample(
+                    sampleIndex, NULL, NULL, &sampleTime);
+        }
+
         if (err != OK) {
             if (err == ERROR_OUT_OF_RANGE) {
                 // An attempt to seek past the end of the stream would
@@ -1984,10 +1990,6 @@
             return err;
         }
 
-        uint32_t sampleTime;
-        CHECK_EQ((status_t)OK, mSampleTable->getMetaDataForSample(
-                    sampleIndex, NULL, NULL, &sampleTime));
-
         if (mode == ReadOptions::SEEK_CLOSEST) {
             targetSampleTimeUs = (sampleTime * 1000000ll) / mTimescale;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 79abfed..d6e4d1b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -87,6 +87,7 @@
 import com.android.systemui.statusbar.policy.BatteryController;
 import com.android.systemui.statusbar.policy.LocationController;
 import com.android.systemui.statusbar.policy.NetworkController;
+import com.android.systemui.statusbar.policy.NotificationRowLayout;
 
 public class PhoneStatusBar extends StatusBar {
     static final String TAG = "PhoneStatusBar";
@@ -103,8 +104,10 @@
     static final int EXPANDED_LEAVE_ALONE = -10000;
     static final int EXPANDED_FULL_OPEN = -10001;
 
-    private static final int MSG_ANIMATE = 1000;
-    private static final int MSG_ANIMATE_REVEAL = 1001;
+    private static final int MSG_ANIMATE = 100;
+    private static final int MSG_ANIMATE_REVEAL = 101;
+    private static final int MSG_OPEN_NOTIFICATION_PANEL = 1000;
+    private static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001;
     private static final int MSG_SHOW_INTRUDER = 1002;
     private static final int MSG_HIDE_INTRUDER = 1003;
     private static final int MSG_OPEN_RECENTS_PANEL = 1020;
@@ -165,7 +168,7 @@
     
     // all notifications
     NotificationData mNotificationData = new NotificationData();
-    ViewGroup mPile;
+    NotificationRowLayout mPile;
 
     // position
     int[] mPositionTmp = new int[2];
@@ -324,7 +327,7 @@
 
         mExpandedDialog = new ExpandedDialog(context);
         mExpandedView = expanded;
-        mPile = (ViewGroup)expanded.findViewById(R.id.latestItems);
+        mPile = (NotificationRowLayout)expanded.findViewById(R.id.latestItems);
         mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout);
         mNoNotificationsTitle = (TextView)expanded.findViewById(R.id.noNotificationsTitle);
         mNoNotificationsTitle.setVisibility(View.GONE); // disabling for now
@@ -332,6 +335,7 @@
         mClearButton = expanded.findViewById(R.id.clear_all_button);
         mClearButton.setOnClickListener(mClearButtonListener);
         mClearButton.setAlpha(0f);
+        mClearButton.setEnabled(false);
         mDateView = (DateView)expanded.findViewById(R.id.date);
         mSettingsButton = expanded.findViewById(R.id.settings_button);
         mSettingsButton.setOnClickListener(mSettingsButtonListener);
@@ -1005,6 +1009,7 @@
         } else {
             mClearButton.setAlpha(clearable ? 1.0f : 0.0f);
         }
+        mClearButton.setEnabled(clearable);
 
         /*
         if (mNoNotificationsTitle.isShown()) {
@@ -1114,6 +1119,12 @@
                 case MSG_ANIMATE_REVEAL:
                     doRevealAnimation();
                     break;
+                case MSG_OPEN_NOTIFICATION_PANEL:
+                    animateExpand();
+                    break;
+                case MSG_CLOSE_NOTIFICATION_PANEL:
+                    animateCollapse();
+                    break;
                 case MSG_SHOW_INTRUDER:
                     setIntruderAlertVisibility(true);
                     break;
@@ -1181,6 +1192,10 @@
     }
 
     public void animateCollapse(boolean excludeRecents) {
+        animateCollapse(excludeRecents, 1.0f);
+    }
+    
+    public void animateCollapse(boolean excludeRecents, float velocityMultiplier) {
         if (SPEW) {
             Slog.d(TAG, "animateCollapse(): mExpanded=" + mExpanded
                     + " mExpandedVisible=" + mExpandedVisible
@@ -1209,7 +1224,7 @@
         // and doesn't try to re-open the windowshade.
         mExpanded = true;
         prepareTracking(y, false);
-        performFling(y, -mSelfCollapseVelocityPx, true);
+        performFling(y, -mSelfCollapseVelocityPx*velocityMultiplier, true);
     }
 
     void performExpand() {
@@ -2086,13 +2101,57 @@
     }
 
     private View.OnClickListener mClearButtonListener = new View.OnClickListener() {
+        final int mini(int a, int b) {
+            return (b>a?a:b);
+        }
         public void onClick(View v) {
-            try {
-                mBarService.onClearAllNotifications();
-            } catch (RemoteException ex) {
-                // system process is dead if we're here.
+            synchronized (mNotificationData) {
+                // let's also queue up 400ms worth of animated dismissals
+                final int N = mini(5, mPile.getChildCount());
+
+                final ArrayList<View> snapshot = new ArrayList<View>(N);
+                for (int i=0; i<N; i++) {
+                    final View child = mPile.getChildAt(i);
+                    if (mPile.canChildBeDismissed(child)) snapshot.add(child);
+                }
+                new Thread(new Runnable() {
+                    @Override
+                    public void run() {
+                        final int ROW_DELAY = 100;
+
+                        mHandler.postDelayed(new Runnable() {
+                            public void run() {
+                                animateCollapse(false, 0f);
+                            }
+                        }, (N-1) * ROW_DELAY);
+
+                        mHandler.postDelayed(new Runnable() {
+                            public void run() {
+                                try {
+                                    mBarService.onClearAllNotifications();
+                                } catch (RemoteException ex) { }
+                            }
+                        }, N * ROW_DELAY + 500);
+
+                        mPile.setAnimateBounds(false); // temporarily disable some re-layouts
+
+                        for (View v : snapshot) {
+                            final View _v = v;
+                            mHandler.post(new Runnable() {
+                                @Override
+                                public void run() {
+                                    mPile.dismissRowAnimated(_v, (int)(ROW_DELAY*0.25f));
+                                }
+                            });
+                            try {
+                                Thread.sleep(ROW_DELAY);
+                            } catch (InterruptedException ex) { }
+                        }
+                        
+                        mPile.setAnimateBounds(true); // reenable layout animation
+                    }
+                }).start();
             }
-            animateCollapse();
         }
     };
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
index 06798c6..a7342dc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
@@ -44,11 +44,11 @@
     private static final boolean DEBUG = false;
     private static final boolean SLOW_ANIMATIONS = DEBUG;
 
-    private static final boolean ANIMATE_LAYOUT = true;
-
     private static final int APPEAR_ANIM_LEN = SLOW_ANIMATIONS ? 5000 : 250;
     private static final int DISAPPEAR_ANIM_LEN = APPEAR_ANIM_LEN;
 
+    boolean mAnimateBounds = true;
+
     Rect mTmpRect = new Rect();
     int mNumRows = 0;
     int mRowHeight = 0;
@@ -93,6 +93,10 @@
         mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, densityScale, pagingTouchSlop);
     }
 
+    public void setAnimateBounds(boolean anim) {
+        mAnimateBounds = anim;
+    }
+
     @Override
     public boolean onInterceptTouchEvent(MotionEvent ev) {
         if (DEBUG) Log.v(TAG, "onInterceptTouchEvent()");
@@ -165,7 +169,7 @@
 
         final View childF = child;
 
-        if (ANIMATE_LAYOUT) {
+        if (mAnimateBounds) {
             child.setPivotY(0);
             final ObjectAnimator alphaFade = ObjectAnimator.ofFloat(child, "alpha", 0f, 1f);
             alphaFade.setDuration(APPEAR_ANIM_LEN);
@@ -185,10 +189,18 @@
         }
     }
 
+    public void dismissRowAnimated(View child) {
+        dismissRowAnimated(child, 0);
+    }
+
+    public void dismissRowAnimated(View child, int vel) {
+        mSwipeHelper.dismissChild(child, vel);
+    }
+
     @Override
     public void removeView(View child) {
         final View childF = child;
-        if (ANIMATE_LAYOUT) {
+        if (mAnimateBounds) {
             if (mAppearingViews.containsKey(child)) {
                 mAppearingViews.remove(child);
             }
@@ -264,7 +276,7 @@
 
             mNumRows = numRows;
 
-            if (ANIMATE_LAYOUT && isShown()) {
+            if (mAnimateBounds && isShown()) {
                 ObjectAnimator.ofInt(this, "forcedHeight", computedHeight)
                     .setDuration(APPEAR_ANIM_LEN)
                     .start();
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
index e92a276..57aae56 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
@@ -390,6 +390,7 @@
 
             if (operatorNumeric == null) {
                 phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
+                mGotCountryCode = false;
             } else {
                 String isoCountryCode = "";
                 try {
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index 0aed77e..8f5a2eb 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -964,6 +964,7 @@
 
             if (operatorNumeric == null) {
                 phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
+                mGotCountryCode = false;
             } else {
                 String isoCountryCode = "";
                 try{
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index d3645fa..eea2780 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -846,6 +846,7 @@
 
             if (operatorNumeric == null) {
                 phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
+                mGotCountryCode = false;
             } else {
                 String iso = "";
                 try{