Merge "Cascading clear-all in the phone notifications panel."
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/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/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/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/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{