Merge change I32d41651 into eclair

* changes:
  Allow a GLThread to release and reacquire the EGL Surface as needed.
diff --git a/api/current.xml b/api/current.xml
index 50b45d6..3ffda95 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -123765,6 +123765,34 @@
 </parameter>
 </method>
 </class>
+<class name="WallpaperSettingsActivity"
+ extends="android.preference.PreferenceActivity"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="WallpaperSettingsActivity"
+ type="android.service.wallpaper.WallpaperSettingsActivity"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<field name="EXTRA_PREVIEW_MODE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.service.wallpaper.PREVIEW_MODE&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
 </package>
 <package name="android.speech"
 >
@@ -172860,6 +172888,17 @@
  visibility="public"
 >
 </constructor>
+<method name="getContentDisposition"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getContentLength"
  return="long"
  abstract="false"
@@ -172904,6 +172943,17 @@
  visibility="public"
 >
 </method>
+<method name="getExpiresString"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getHttpStatusCode"
  return="int"
  abstract="false"
@@ -173028,6 +173078,23 @@
 <parameter name="w" type="android.webkit.WebView">
 </parameter>
 </constructor>
+<method name="addMessageToConsole"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="message" type="java.lang.String">
+</parameter>
+<parameter name="lineNumber" type="int">
+</parameter>
+<parameter name="sourceID" type="java.lang.String">
+</parameter>
+</method>
 <method name="createWindow"
  return="android.webkit.WebView"
  abstract="false"
@@ -173080,6 +173147,30 @@
  visibility="public"
 >
 </method>
+<method name="getVisitedHistory"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="callback" type="android.webkit.ValueCallback&lt;java.lang.String[]&gt;">
+</parameter>
+</method>
+<method name="getWebChromeClient"
+ return="android.webkit.WebChromeClient"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="onCloseWindow"
  return="void"
  abstract="false"
@@ -173152,6 +173243,32 @@
 <parameter name="resend" type="android.os.Message">
 </parameter>
 </method>
+<method name="onGeolocationPermissionsHidePrompt"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="onGeolocationPermissionsShowPrompt"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="origin" type="java.lang.String">
+</parameter>
+<parameter name="callback" type="android.webkit.GeolocationPermissions.Callback">
+</parameter>
+</method>
 <method name="onJsAlert"
  return="void"
  abstract="false"
@@ -173214,6 +173331,17 @@
 <parameter name="defaultValue" type="java.lang.String">
 </parameter>
 </method>
+<method name="onJsTimeout"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="onLoadResource"
  return="void"
  abstract="false"
@@ -173268,6 +173396,23 @@
 <parameter name="newProgress" type="int">
 </parameter>
 </method>
+<method name="onReachedMaxAppCacheSize"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="spaceNeeded" type="long">
+</parameter>
+<parameter name="totalUsedQuota" type="long">
+</parameter>
+<parameter name="quotaUpdater" type="android.webkit.WebStorage.QuotaUpdater">
+</parameter>
+</method>
 <method name="onReceivedError"
  return="void"
  abstract="false"
@@ -173754,6 +173899,82 @@
  visibility="public"
 >
 </constructor>
+<method name="allow"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="origin" type="java.lang.String">
+</parameter>
+</method>
+<method name="clear"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="origin" type="java.lang.String">
+</parameter>
+</method>
+<method name="clearAll"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getAllowed"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="origin" type="java.lang.String">
+</parameter>
+<parameter name="callback" type="android.webkit.ValueCallback&lt;java.lang.Boolean&gt;">
+</parameter>
+</method>
+<method name="getInstance"
+ return="android.webkit.GeolocationPermissions"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getOrigins"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="callback" type="android.webkit.ValueCallback&lt;java.util.Set&gt;">
+</parameter>
+</method>
 </class>
 <interface name="GeolocationPermissions.Callback"
  abstract="true"
@@ -174751,6 +174972,27 @@
 >
 </method>
 </class>
+<interface name="ValueCallback"
+ abstract="true"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onReceiveValue"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="value" type="T">
+</parameter>
+</method>
+</interface>
 <class name="WebBackForwardList"
  extends="java.lang.Object"
  abstract="false"
@@ -174826,6 +175068,58 @@
  visibility="public"
 >
 </constructor>
+<method name="addMessageToConsole"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="message" type="java.lang.String">
+</parameter>
+<parameter name="lineNumber" type="int">
+</parameter>
+<parameter name="sourceID" type="java.lang.String">
+</parameter>
+</method>
+<method name="getDefaultVideoPoster"
+ return="android.graphics.Bitmap"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getVideoLoadingProgressView"
+ return="android.view.View"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getVisitedHistory"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="callback" type="android.webkit.ValueCallback&lt;java.lang.String[]&gt;">
+</parameter>
+</method>
 <method name="onCloseWindow"
  return="void"
  abstract="false"
@@ -174907,6 +175201,17 @@
 <parameter name="callback" type="android.webkit.GeolocationPermissions.Callback">
 </parameter>
 </method>
+<method name="onHideCustomView"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="onJsAlert"
  return="boolean"
  abstract="false"
@@ -174985,6 +175290,17 @@
 <parameter name="result" type="android.webkit.JsPromptResult">
 </parameter>
 </method>
+<method name="onJsTimeout"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="onProgressChanged"
  return="void"
  abstract="false"
@@ -175000,6 +175316,23 @@
 <parameter name="newProgress" type="int">
 </parameter>
 </method>
+<method name="onReachedMaxAppCacheSize"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="spaceNeeded" type="long">
+</parameter>
+<parameter name="totalUsedQuota" type="long">
+</parameter>
+<parameter name="quotaUpdater" type="android.webkit.WebStorage.QuotaUpdater">
+</parameter>
+</method>
 <method name="onReceivedIcon"
  return="void"
  abstract="false"
@@ -175030,6 +175363,23 @@
 <parameter name="title" type="java.lang.String">
 </parameter>
 </method>
+<method name="onReceivedTouchIconUrl"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="view" type="android.webkit.WebView">
+</parameter>
+<parameter name="url" type="java.lang.String">
+</parameter>
+<parameter name="precomposed" type="boolean">
+</parameter>
+</method>
 <method name="onRequestFocus"
  return="void"
  abstract="false"
@@ -175043,7 +175393,41 @@
 <parameter name="view" type="android.webkit.WebView">
 </parameter>
 </method>
+<method name="onShowCustomView"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="view" type="android.view.View">
+</parameter>
+<parameter name="callback" type="android.webkit.WebChromeClient.CustomViewCallback">
+</parameter>
+</method>
 </class>
+<interface name="WebChromeClient.CustomViewCallback"
+ abstract="true"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onCustomViewHidden"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</interface>
 <class name="WebHistoryItem"
  extends="java.lang.Object"
  abstract="false"
@@ -175347,6 +175731,28 @@
  visibility="public"
 >
 </method>
+<method name="getDefaultZoom"
+ return="android.webkit.WebSettings.ZoomDensity"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getDomStorageEnabled"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="true"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getFantasyFontFamily"
  return="java.lang.String"
  abstract="false"
@@ -175413,6 +175819,17 @@
  visibility="public"
 >
 </method>
+<method name="getLoadWithOverviewMode"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getLoadsImagesAutomatically"
  return="boolean"
  abstract="false"
@@ -175602,6 +176019,45 @@
 <parameter name="allow" type="boolean">
 </parameter>
 </method>
+<method name="setAppCacheEnabled"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="true"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="flag" type="boolean">
+</parameter>
+</method>
+<method name="setAppCacheMaxSize"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="true"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="appCacheMaxSize" type="long">
+</parameter>
+</method>
+<method name="setAppCachePath"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="true"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="appCachePath" type="java.lang.String">
+</parameter>
+</method>
 <method name="setBlockNetworkImage"
  return="void"
  abstract="false"
@@ -175719,6 +176175,32 @@
 <parameter name="encoding" type="java.lang.String">
 </parameter>
 </method>
+<method name="setDefaultZoom"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="zoom" type="android.webkit.WebSettings.ZoomDensity">
+</parameter>
+</method>
+<method name="setDomStorageEnabled"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="true"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="flag" type="boolean">
+</parameter>
+</method>
 <method name="setFantasyFontFamily"
  return="void"
  abstract="false"
@@ -175823,6 +176305,19 @@
 <parameter name="enabled" type="boolean">
 </parameter>
 </method>
+<method name="setLoadWithOverviewMode"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="overview" type="boolean">
+</parameter>
+</method>
 <method name="setLoadsImagesAutomatically"
  return="void"
  abstract="false"
@@ -176260,6 +176755,39 @@
 >
 </method>
 </class>
+<class name="WebSettings.ZoomDensity"
+ extends="java.lang.Enum"
+ abstract="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="valueOf"
+ return="android.webkit.WebSettings.ZoomDensity"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="name" type="java.lang.String">
+</parameter>
+</method>
+<method name="values"
+ return="android.webkit.WebSettings.ZoomDensity[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</class>
 <class name="WebStorage"
  extends="java.lang.Object"
  abstract="false"
@@ -176276,6 +176804,99 @@
  visibility="public"
 >
 </constructor>
+<method name="deleteAllData"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="deleteOrigin"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="origin" type="java.lang.String">
+</parameter>
+</method>
+<method name="getInstance"
+ return="android.webkit.WebStorage"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getOrigins"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="callback" type="android.webkit.ValueCallback&lt;java.util.Map&gt;">
+</parameter>
+</method>
+<method name="getQuotaForOrigin"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="origin" type="java.lang.String">
+</parameter>
+<parameter name="callback" type="android.webkit.ValueCallback&lt;java.lang.Long&gt;">
+</parameter>
+</method>
+<method name="getUsageForOrigin"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="origin" type="java.lang.String">
+</parameter>
+<parameter name="callback" type="android.webkit.ValueCallback&lt;java.lang.Long&gt;">
+</parameter>
+</method>
+<method name="setQuotaForOrigin"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="origin" type="java.lang.String">
+</parameter>
+<parameter name="quota" type="long">
+</parameter>
+</method>
 </class>
 <interface name="WebStorage.QuotaUpdater"
  abstract="true"
@@ -176717,6 +177338,17 @@
 <parameter name="vy" type="int">
 </parameter>
 </method>
+<method name="freeMemory"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getCertificate"
  return="android.net.http.SslCertificate"
  abstract="false"
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp
index 29531ca..e548524 100644
--- a/camera/libcameraservice/CameraService.cpp
+++ b/camera/libcameraservice/CameraService.cpp
@@ -1215,20 +1215,27 @@
     // the callback. For efficiency, reuse the same MemoryHeapBase
     // provided it's big enough. Don't allocate the memory or
     // perform the copy if there's no callback.
-    if (mPreviewBuffer == 0) {
-        mPreviewBuffer = new MemoryHeapBase(size, 0, NULL);
-    } else if (size > mPreviewBuffer->virtualSize()) {
-        mPreviewBuffer.clear();
-        mPreviewBuffer = new MemoryHeapBase(size, 0, NULL);
+
+    // hold the lock while we grab a reference to the preview buffer
+    sp<MemoryHeapBase> previewBuffer;
+    {
+        Mutex::Autolock lock(mLock);
+        if (mPreviewBuffer == 0) {
+            mPreviewBuffer = new MemoryHeapBase(size, 0, NULL);
+        } else if (size > mPreviewBuffer->virtualSize()) {
+            mPreviewBuffer.clear();
+            mPreviewBuffer = new MemoryHeapBase(size, 0, NULL);
+        }
         if (mPreviewBuffer == 0) {
             LOGE("failed to allocate space for preview buffer");
             return;
         }
+        previewBuffer = mPreviewBuffer;
     }
-    memcpy(mPreviewBuffer->base(),
+    memcpy(previewBuffer->base(),
            (uint8_t *)heap->base() + offset, size);
 
-    sp<MemoryBase> frame = new MemoryBase(mPreviewBuffer, 0, size);
+    sp<MemoryBase> frame = new MemoryBase(previewBuffer, 0, size);
     if (frame == 0) {
         LOGE("failed to allocate space for frame callback");
         return;
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index b5b88f3..ce36c4b 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -437,6 +437,9 @@
     nsecs_t lastFrame = systemTime();
     nsecs_t frameDuration = s2ns(1) / animation.fps;
 
+    Region clearReg(Rect(mWidth, mHeight));
+    clearReg.subtractSelf(Rect(xc, yc, xc+animation.width, yc+animation.height));
+
     for (int i=0 ; i<pcount && !exitPending() ; i++) {
         const Animation::Part& part(animation.parts[i]);
         const size_t fcount = part.frames.size();
@@ -460,6 +463,18 @@
                             frame.map->getDataLength());
                 }
 
+                if (!clearReg.isEmpty()) {
+                    Region::const_iterator head(clearReg.begin());
+                    Region::const_iterator tail(clearReg.end());
+                    glEnable(GL_SCISSOR_TEST);
+                    while (head != tail) {
+                        const Rect& r(*head++);
+                        glScissor(r.left, mHeight - r.bottom,
+                                r.width(), r.height());
+                        glClear(GL_COLOR_BUFFER_BIT);
+                    }
+                    glDisable(GL_SCISSOR_TEST);
+                }
                 glDrawTexiOES(xc, yc, 0, animation.width, animation.height);
                 eglSwapBuffers(mDisplay, mSurface);
 
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 8faef59ba..e5a769b 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -1646,8 +1646,11 @@
         Intent intent = new Intent(action);
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         // We need CLEAR_TOP to avoid reusing an old task that has other activities
-        // on top of the one we want.
-        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+        // on top of the one we want. We don't want to do this in in-app search though,
+        // as it can be destructive to the activity stack.
+        if (mGlobalSearchMode) {
+            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+        }
         if (data != null) {
             intent.setData(data);
         }
diff --git a/core/java/android/service/wallpaper/WallpaperSettingsActivity.java b/core/java/android/service/wallpaper/WallpaperSettingsActivity.java
index cde5ab25..501947da 100644
--- a/core/java/android/service/wallpaper/WallpaperSettingsActivity.java
+++ b/core/java/android/service/wallpaper/WallpaperSettingsActivity.java
@@ -24,7 +24,6 @@
  * Base class for activities that will be used to configure the settings of
  * a wallpaper.  You should derive from this class to allow it to select the
  * proper theme of the activity depending on how it is being used.
- * @hide Live Wallpaper
  */
 public class WallpaperSettingsActivity extends PreferenceActivity {
     /**
diff --git a/core/java/android/webkit/CacheManager.java b/core/java/android/webkit/CacheManager.java
index 02e8d6f..75028de 100644
--- a/core/java/android/webkit/CacheManager.java
+++ b/core/java/android/webkit/CacheManager.java
@@ -109,9 +109,6 @@
             return expires;
         }
 
-        /**
-         * @hide Pending API council approval
-         */
         public String getExpiresString() {
             return expiresString;
         }
@@ -136,9 +133,6 @@
             return encoding;
         }
 
-        /**
-         * @hide Pending API council approval
-         */
         public String getContentDisposition() {
             return contentdisposition;
         }
diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java
index 8d55247..f760b61 100644
--- a/core/java/android/webkit/CallbackProxy.java
+++ b/core/java/android/webkit/CallbackProxy.java
@@ -159,8 +159,6 @@
     /**
      * Get the WebChromeClient.
      * @return the current WebChromeClient instance.
-     *
-     *@hide pending API council approval.
      */
     public WebChromeClient getWebChromeClient() {
        return mWebChromeClient;
@@ -1237,7 +1235,6 @@
      * @param quotaUpdater An instance of a class encapsulating a callback
      * to WebViewCore to run when the decision to allow or deny a bigger
      * app cache size has been made.
-     * @hide pending API council approval.
      */
     public void onReachedMaxAppCacheSize(long spaceNeeded,
             long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) {
@@ -1261,7 +1258,6 @@
      * @param origin The origin requesting Geolocation permsissions.
      * @param callback The callback to call once a permission state has been
      *     obtained.
-     * @hide pending API council review.
      */
     public void onGeolocationPermissionsShowPrompt(String origin,
             GeolocationPermissions.Callback callback) {
@@ -1281,8 +1277,6 @@
     /**
      * Called by WebViewCore to instruct the browser to hide the Geolocation
      * permissions prompt.
-     * origin.
-     * @hide pending API council review.
      */
     public void onGeolocationPermissionsHidePrompt() {
         if (mWebChromeClient == null) {
@@ -1301,7 +1295,6 @@
      *     occurred.
      * @param sourceID The filename of the source file in which the error
      *     occurred.
-     * @hide pending API counsel.
      */
     public void addMessageToConsole(String message, int lineNumber, String sourceID) {
         if (mWebChromeClient == null) {
@@ -1315,9 +1308,6 @@
         sendMessage(msg);
     }
 
-    /**
-     * @hide pending API council approval
-     */
     public boolean onJsTimeout() {
         //always interrupt timedout JS by default
         if (mWebChromeClient == null) {
@@ -1337,9 +1327,6 @@
         return result.getResult();
     }
 
-    /**
-     * @hide pending API council approval
-     */
     public void getVisitedHistory(ValueCallback<String[]> callback) {
         if (mWebChromeClient == null) {
             return;
diff --git a/core/java/android/webkit/GeolocationPermissions.java b/core/java/android/webkit/GeolocationPermissions.java
index 483e9e9..64a9d9b 100755
--- a/core/java/android/webkit/GeolocationPermissions.java
+++ b/core/java/android/webkit/GeolocationPermissions.java
@@ -71,7 +71,6 @@
 
     /**
      * Gets the singleton instance of the class.
-     * @hide
      */
     public static GeolocationPermissions getInstance() {
       if (sInstance == null) {
@@ -188,7 +187,6 @@
      * WebCore::SecurityOrigin::toString(). As long as all 'HTML 5 modules'
      * (Database, Geolocation etc) do so, it's safe to match up origins for the
      * purposes of displaying UI.
-     * @hide
      */
     public void getOrigins(ValueCallback<Set> callback) {
         if (callback != null) {
@@ -212,7 +210,6 @@
 
     /**
      * Gets the permission state for the specified origin.
-     * @hide
      */
     public void getAllowed(String origin, ValueCallback<Boolean> callback) {
         if (callback == null) {
@@ -245,7 +242,6 @@
      * Clears the permission state for the specified origin. This method may be
      * called before the WebKit thread has intialized the message handler.
      * Messages will be queued until this time.
-     * @hide
      */
     public void clear(String origin) {
         // Called on the UI thread.
@@ -266,7 +262,6 @@
      * Allows the specified origin. This method may be called before the WebKit
      * thread has intialized the message handler. Messages will be queued until
      * this time.
-     * @hide
      */
     public void allow(String origin) {
         // Called on the UI thread.
@@ -285,7 +280,6 @@
 
     /**
      * Clears the permission state for all origins.
-     * @hide
      */
     public void clearAll() {
         // Called on the UI thread.
diff --git a/core/java/android/webkit/GeolocationService.java b/core/java/android/webkit/GeolocationService.java
index 646f8c5..24306f4 100755
--- a/core/java/android/webkit/GeolocationService.java
+++ b/core/java/android/webkit/GeolocationService.java
@@ -30,9 +30,8 @@
 
 /**
  * Implements the Java side of GeolocationServiceAndroid.
- * @hide Pending API council review.
  */
-public final class GeolocationService implements LocationListener {
+final class GeolocationService implements LocationListener {
 
     // Log tag
     private static final String TAG = "geolocationService";
diff --git a/core/java/android/webkit/GoogleLocationSettingManager.java b/core/java/android/webkit/GoogleLocationSettingManager.java
index 508df3b..ecac70a 100644
--- a/core/java/android/webkit/GoogleLocationSettingManager.java
+++ b/core/java/android/webkit/GoogleLocationSettingManager.java
@@ -32,7 +32,6 @@
  * Security - Share with Google' and the browser. When this setting is set
  * to true, we allow Geolocation for Google origins. When this setting is
  * set to false, we clear Geolocation permissions for Google origins.
- * @hide pending API council review
  */
 class GoogleLocationSettingManager {
     // The observer used to listen to the system setting.
diff --git a/core/java/android/webkit/MockGeolocation.java b/core/java/android/webkit/MockGeolocation.java
index 028cb19..fbda492 100644
--- a/core/java/android/webkit/MockGeolocation.java
+++ b/core/java/android/webkit/MockGeolocation.java
@@ -19,7 +19,7 @@
 /**
  * This class is simply a container for the methods used to configure WebKit's
  * mock Geolocation service for use in LayoutTests.
- * @hide Pending API council review.
+ * @hide
  */
 public final class MockGeolocation {
 
diff --git a/core/java/android/webkit/ValueCallback.java b/core/java/android/webkit/ValueCallback.java
index d8c5cdc..1a167e8 100644
--- a/core/java/android/webkit/ValueCallback.java
+++ b/core/java/android/webkit/ValueCallback.java
@@ -18,12 +18,10 @@
 
 /**
  * A callback interface used to returns values asynchronously
- *
- * @hide pending council approval
  */
-public interface ValueCallback<T>  {
-  /**
-   * Invoked when we have the result
-   */
-  public void onReceiveValue(T value);
+public interface ValueCallback<T> {
+    /**
+     * Invoked when we have the result
+     */
+    public void onReceiveValue(T value);
 };
diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java
index 7f5b862..92676aa 100644
--- a/core/java/android/webkit/WebChromeClient.java
+++ b/core/java/android/webkit/WebChromeClient.java
@@ -49,7 +49,6 @@
      * @param view The WebView that initiated the callback.
      * @param url The icon url.
      * @param precomposed True if the url is for a precomposed touch icon.
-     * @hide pending council approval
      */
     public void onReceivedTouchIconUrl(WebView view, String url,
             boolean precomposed) {}
@@ -57,8 +56,6 @@
     /**
      * A callback interface used by the host application to notify
      * the current page that its custom view has been dismissed.
-     *
-     * @hide pending council approval
      */
     public interface CustomViewCallback {
         /**
@@ -74,16 +71,12 @@
      * @param view is the View object to be shown.
      * @param callback is the callback to be invoked if and when the view
      * is dismissed.
-     *
-     * @hide pending council approval
      */
     public void onShowCustomView(View view, CustomViewCallback callback) {};
 
     /**
      * Notify the host application that the current page would
      * like to hide its custom view.
-     *
-     * @hide pending council approval
      */
     public void onHideCustomView() {}
 
@@ -230,7 +223,6 @@
     * @param quotaUpdater A callback to inform the WebCore thread that a new
     * app cache size is available. This callback must always be executed at
     * some point to ensure that the sleeping WebCore thread is woken up.
-    * @hide pending API council approval.
     */
     public void onReachedMaxAppCacheSize(long spaceNeeded, long totalUsedQuota,
             WebStorage.QuotaUpdater quotaUpdater) {
@@ -258,7 +250,6 @@
      * will continue to occur if the script does not finish at the next check
      * point.
      * @return boolean Whether the JavaScript execution should be interrupted.
-     * @hide pending API Council approval
      */
     public boolean onJsTimeout() {
         return true;
@@ -270,7 +261,6 @@
      * @param message The error message to report.
      * @param lineNumber The line number of the error.
      * @param sourceID The name of the source file that caused the error.
-     * @hide pending API council.
      */
     public void addMessageToConsole(String message, int lineNumber, String sourceID) {}
 
@@ -279,7 +269,6 @@
      * This icon will be used if the Web page did not specify a poster attribute.
      *
      * @return Bitmap The icon or null if no such icon is available.
-     * @hide pending API Council approval
      */
     public Bitmap getDefaultVideoPoster() {
         return null;
@@ -290,14 +279,12 @@
      * a <video> is loading.
      *
      * @return View The progress view.
-     * @hide pending API Council approval
      */
     public View getVideoLoadingProgressView() {
         return null;
     }
 
     /** Obtains a list of all visited history items, used for link coloring
-     * @hide pending API Council approval
      */
     public void getVisitedHistory(ValueCallback<String[]> callback) {
     }
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 4fedec9..6f3262a 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -74,7 +74,6 @@
      * FAR makes 100% looking like in 240dpi
      * MEDIUM makes 100% looking like in 160dpi
      * CLOSE makes 100% looking like in 120dpi
-     * @hide Pending API council approval
      */
     public enum ZoomDensity {
         FAR(150),      // 240dpi
@@ -452,7 +451,6 @@
 
     /**
      * Set whether the WebView loads a page with overview mode.
-     * @hide Pending API council approval
      */
     public void setLoadWithOverviewMode(boolean overview) {
         mLoadWithOverviewMode = overview;
@@ -460,7 +458,6 @@
 
     /**
      * Returns true if this WebView loads page with overview mode
-     * @hide Pending API council approval
      */
     public boolean getLoadWithOverviewMode() {
         return mLoadWithOverviewMode;
@@ -522,7 +519,6 @@
      * thread.
      * @param zoom A ZoomDensity value
      * @see WebSettings.ZoomDensity
-     * @hide Pending API council approval
      */
     public void setDefaultZoom(ZoomDensity zoom) {
         if (mDefaultZoom != zoom) {
@@ -536,7 +532,6 @@
      * thread.
      * @return A ZoomDensity value
      * @see WebSettings.ZoomDensity
-     * @hide Pending API council approval
      */
     public ZoomDensity getDefaultZoom() {
         return mDefaultZoom;
@@ -1016,7 +1011,6 @@
     /**
      * Tell the WebView to enable Application Caches API.
      * @param flag True if the WebView should enable Application Caches.
-     * @hide pending api council approval
      */
     public synchronized void setAppCacheEnabled(boolean flag) {
         if (mAppCacheEnabled != flag) {
@@ -1031,7 +1025,6 @@
      * @param appCachePath String path to the directory containing Application
      * Caches files. The appCache path can be the empty string but should not
      * be null. Passing null for this parameter will result in a no-op.
-     * @hide pending api council approval
      */
     public synchronized void setAppCachePath(String appCachePath) {
         if (appCachePath != null && !appCachePath.equals(mAppCachePath)) {
@@ -1043,8 +1036,6 @@
     /**
      * Set the maximum size for the Application Caches content.
      * @param appCacheMaxSize the maximum size in bytes.
-     *
-     * @hide pending api council approval
      */
     public synchronized void setAppCacheMaxSize(long appCacheMaxSize) {
         if (appCacheMaxSize != mAppCacheMaxSize) {
@@ -1069,7 +1060,6 @@
      * Set whether the DOM storage API is enabled.
      * @param flag boolean True if the WebView should use the DOM storage
      *     API.
-     * @hide pending API council.
      */
     public synchronized void setDomStorageEnabled(boolean flag) {
        if (mDomStorageEnabled != flag) {
@@ -1081,7 +1071,6 @@
     /**
      * Returns true if the DOM Storage API's are enabled.
      * @return True if the DOM Storage API's are enabled.
-     * @hide pending API council.
      */
     public synchronized boolean getDomStorageEnabled() {
        return mDomStorageEnabled;
diff --git a/core/java/android/webkit/WebStorage.java b/core/java/android/webkit/WebStorage.java
index 0022248..a182287 100644
--- a/core/java/android/webkit/WebStorage.java
+++ b/core/java/android/webkit/WebStorage.java
@@ -229,7 +229,6 @@
      */
 
     /**
-     * @hide
      * Returns a list of origins having a database
      */
     public void getOrigins(ValueCallback<Map> callback) {
@@ -256,7 +255,6 @@
     }
 
     /**
-     * @hide
      * Returns the use for a given origin
      */
     public void getUsageForOrigin(String origin, ValueCallback<Long> callback) {
@@ -280,7 +278,6 @@
     }
 
     /**
-     * @hide
      * Returns the quota for a given origin
      */
     public void getQuotaForOrigin(String origin, ValueCallback<Long> callback) {
@@ -304,7 +301,6 @@
     }
 
     /**
-     * @hide
      * Set the quota for a given origin
      */
     public void setQuotaForOrigin(String origin, long quota) {
@@ -319,7 +315,6 @@
     }
 
     /**
-     * @hide
      * Delete a given origin
      */
     public void deleteOrigin(String origin) {
@@ -334,7 +329,6 @@
     }
 
     /**
-     * @hide
      * Delete all databases
      */
     public void deleteAllData() {
@@ -364,7 +358,6 @@
     }
 
     /**
-     * @hide
      * Get the global instance of WebStorage.
      * @return A single instance of WebStorage.
      */
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 06c70ca..142dffb 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2265,7 +2265,6 @@
     /**
      * Call this to inform the view that memory is low so that it can
      * free any available memory.
-     * @hide
      */
     public void freeMemory() {
         mWebViewCore.sendMessage(EventHub.FREE_MEMORY);
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 165794a..271989a 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2203,6 +2203,9 @@
                 clearScrollingCache();
             }
             mLastY = Integer.MIN_VALUE;
+            if (mTouchMode == TOUCH_MODE_FLING) {
+                return true;
+            }
             break;
         }
 
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 9058221..aaa1d8b 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -200,6 +200,11 @@
     <integer-array name="config_autoBrightnessKeyboardBacklightValues">
     </integer-array>
 
+    <!-- Amount of time it takes for the light sensor to warm up in milliseconds.
+         For this time after the screen turns on, the Power Manager
+         will not debounce light sensor readings -->
+    <integer name="config_lightSensorWarmupTime">0</integer>
+
     <!-- Enables swipe versus poly-finger touch disambiguation in the KeyboardView -->
     <bool name="config_swipeDisambiguation">true</bool>
 </resources>
diff --git a/docs/html/guide/developing/device.jd b/docs/html/guide/developing/device.jd
index 9dea053..8fa4cec 100644
--- a/docs/html/guide/developing/device.jd
+++ b/docs/html/guide/developing/device.jd
@@ -11,8 +11,16 @@
         <li><a href="#dev-phone-1">Android Dev Phone 1</a></li>
       </ol>
     </li>
-    <li><a href="#setting-up">Setting up a Device for Development</a></li>
-    <li><a href="#WinUsbDriver">Installing the WinUsb Driver</a></li>
+    <li><a href="#setting-up">Setting up a Device for Development</a>
+      <ol>
+        <li><a href="#VendorIds">USB Vendor IDs</a></li>
+      </ol>
+    </li>
+  </ol>
+  <h2>See also</h2>
+  <ol>
+    <li><a
+    href="{@docRoot}sdk/win-usb.html">USB Driver for Windows</a></li>
   </ol>
 </div>
 </div>
@@ -117,27 +125,36 @@
   <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>
-
   </li>
   <li>Setup your system to detect your device.
     <ul>
-      <li>If you're developing on Windows, you need to install a USB driver for adb. 
-        Follow the steps below for <a href="#WinUsbDriver">Installing the WinUsb Driver</a>.</li>
+      <li>If you're developing on Windows, you need to install a USB driver
+      for adb. See the <a href="{@docRoot}sdk/win-usb.html">Windows USB
+      Driver</a> documentation.</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:
+      <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>Login 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>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>
 
-            <p>For Dapper, edit the file to read: <br/>
-              <code>SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666"</code></p>
+            <p>For Dapper, edit the file to read:<br/>
+            <code>SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4",
+            MODE="0666"</code></p>
           </li>
           <li>Now execute:<br/>
               <code>chmod a+r /etc/udev/rules.d/51-android.rules</code>
           </li>
         </ol>
-
       </li>
     </ul>
   </li>
@@ -149,157 +166,30 @@
 Select the device to install and run the application there.</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>
+you can issue commands with the <code>-d</code> flag to target your
+connected device.</p>
 
 
-
-
-<h2 id="WinUsbDriver">Installing the WinUsb Driver</h2>
-
-<p>A WinUsb-based driver is needed in order to use your Android-powered device for development on a Windows machine.
-The USB installation package can be found in the <code><em>&lt;sdk></em>\usb_driver\</code> 
-folder of your SDK package.</p>
-
-<p class="note"><strong>Note:</strong> If you are connecting an Android-powered device to your computer
-for the first time, folllow the procedure to "Perform a fresh installation."
-Android SDKs older than version 1.6 included a non-WinUsb-based driver
-for connecting your device. If you installed the older USB driver and it is working properly,
-you do not need to upgrade to the new driver. However, if you are having problems with the driver or 
-would simply like to upgrade to the latest version, follow the procedure to "Upgrade an existing
-driver." </p>
-
-<p>Before you begin installing or upgrading the USB driver, you must
-copy the USB installation package to a secure location on your computer.
-For example, you might want to create a directory at <code>C:\Android\Windows\USB\install\</code> and
-move it there. Once you've moved the installation package, select the appropriate procedure below, 
-based on your operating system and whether you're installing for the first time or upgrading.</p>
-
-<ol class="nolist">
-  <li>Windows Vista:
-    <ol class="nolist">
-      <li><a href="#VistaFreshInstall">Perform a fresh installation</a></li>
-      <li><a href="#VistaUprade">Upgrade an existing driver</a></li>
-    </ol>
-  </li>
-  <li>Windows XP:
-    <ol class="nolist">
-      <li><a href="#XPFreshInstall">Perform a fresh installation</a></li>
-      <li><a href="#XPUpgrade">Upgrade an existing driver</a></li>
-    </ol>
-  </li>
-</ol>
-
-
-<p class="caution"><strong>Caution:</strong>
-You may make changes to <code>android_winusb.inf</code> file found inside <code>usb_driver\</code>
-(e.g., to add support for new devices), 
-however, this will lead to security warnings when you install or upgrade the
-driver. Making any other changes to the driver files may break the installation process.</p>
-
-<h3 id="VistaFreshInstall">Windows Vista: Perform a fresh installation</h3>
-
-<p>To install the Android USB driver on Windows Vista for the first time:</p>
-
-<ol>
-  <li>Connect your Android-powered device to your computer's USB port. Windows will detect the device
-    and launch the Found New Hardware wizard.</li>
-  <li>Select "Locate and install driver software."</li>
-  <li>Select "Don't search online."</li>
-  <li>Select "I don't have the disk. Show me other options."</li>
-  <li>Select "Browse my computer for driver software."</li>
-  <li>Click "Browse..." and locate the folder where you copied the
-    installation package. As long as you specified the exact location of the 
-    installation package, you may leave "Include subfolders" checked or unchecked&mdash;it doesn't matter.</li>
-  <li>Click "Next." Vista may prompt you to confirm the privilege elevation required for driver 
-    installation. Confirm it.</li>
-  <li>When Vista asks if you'd like to install the Google ADB Interface device, click "Install"
-    to install the driver.</li>
-</ol>
-
-<p>Return to <a href="#setting-up">Setting up a Device for Development</a>.</p>
-
-
-
-<h3 id="VistaUpgrade">Windows Vista: Upgrade an existing driver</h3>
-
-<p>To upgrade an existing Android USB driver on Windows Vista with the new one:</p>
-
-<ol>
-  <li>Connect your Android-powered device to your computer's USB port.</li>
-  <li>Right-click on "Computer" from your desktop or Windows Explorer,
-    and select "Manage."</li>
-  <li>Select "Device Manager" in the left pane of the Computer Management window.</li>
-  <li>Locate and expand "ADB Interface" in the right pane.</li>
-  <li>Right-click on "HTC Dream Composite ADB Interface", and select "Update Driver Software..."</li>
-  <li>When Vista starts updating the driver, a prompt will ask how you want to search for the driver 
-    software. Select "Browse my computer for driver software."</li>
-  <li>Click "Browse..." and locate the folder where you copied the
-    installation package. As long as you specified the exact location of the 
-    installation package, you may leave "Include subfolders" checked or unchecked&mdash;it doesn't matter.</li>
-  <li>Click "Next." Vista may prompt you to confirm the privilege elevation required for driver 
-  installation. Confirm it.</li>
-  <li>When Vista asks if you'd like to install the Google ADB Interface device, click "Install"
-    to install the driver.</li>
-</ol>
-
-<p>Return to <a href="#setting-up">Setting up a Device for Development</a>.</p>
-
-
-
-<h3 id="XPFreshInstall">Windows XP: Perform a fresh installation</h3>
-
-<p>To install the Android USB driver on Windows XP for the first time:</p>
-
-<ol>
-  <li>Connect your Android-powered device to your computer's USB port. Windows 
-    will detect the device and launch the Hardware Update Wizard.</li>
-  <li>Select "Install from a list or specific location" and click
-    "Next."</li>
-  <li>Select "Search for the best driver in these locations"; uncheck "Search 
-    removable media"; and check "Include this location in the search."</li>
-  <li>Click "Browse..." and locate the folder where you copied the installation 
-    package.</li>
-  <li>Click "Next" to install the driver.</li>
-</ol>
-
-<p>Return to <a href="#setting-up">Setting up a Device for Development</a>.</p>
-
-
-
-<h3 id="XPUpgrade">Windows XP: Upgrade an existing driver</h3>
-
-<p>To upgrade an existing Android USB driver on Windows XP with the new one:</p>
-
-<ol>
-  <li>Connect your Android-powered device to your computer's USB port.</li>
-  <li>Right-click on "My Computer" from your desktop or Windows Explorer,
-    and select "Manage."</li>
-  <li>Select "Device Manager" in the left pane of the Computer Management window.</li>
-  <li>Locate and expand "Android Phone" in the right pane.</li>
-  <li>Right-click "Android Composite ADB Interface" and select "Update Driver..."
-    This will launch the Hardware Update Wizard.</li>
-  <li>Select "Install from a list or specific location" and click
-    "Next."</li>
-  <li>Select "Search for the best driver in these locations"; uncheck "Search 
-    removable media"; and check "Include this location in the search."</li>
-  <li>Click "Browse..." and locate the folder where you copied the installation 
-    package.</li>
-  <li>Click "Next" to install the driver.</li>
-</ol>
-
-<p>Return to <a href="#setting-up">Setting up a Device for Development</a>.</p>
-  
-
-
-
-
-
-
-
-
-
-
-
-
-
+<h3 id="VendorIds">USB Vendor IDs</h3>
+<p>This table provides a reference to the vendor IDs needed in order to add
+device support on Linux. The USB Vendor ID is the value given to the
+<code>SYSFS{idVendor}</code> property in the rules file.</p>
+<table>
+  <tr>
+    <th>Manufacturer</th><th>USB Vendor ID</th></tr>
+  <tr>
+    <td>Acer</td><td>0502</td></tr>
+  <tr>
+    <td>HTC</td><td>0bb4</td></tr>
+  <tr>
+    <td>Huawei</td><td>12d1</td></tr>
+  <tr>
+    <td>LG</td><td>1004</td></tr>
+  <tr>
+    <td>Motorola</td><td>22b8</td></tr>
+  <tr>
+    <td>Samsung</td><td>04e8</td></tr>
+  <tr>
+    <td>Sony Ericsson</td><td>0fce</td></tr>
+</table>
 
diff --git a/docs/html/sdk/sdk_toc.cs b/docs/html/sdk/sdk_toc.cs
index 900b067..4aed0ca 100644
--- a/docs/html/sdk/sdk_toc.cs
+++ b/docs/html/sdk/sdk_toc.cs
@@ -75,7 +75,11 @@
       </li>
     </ul>
     <ul>
-      <li><a href="<?cs var:toroot ?>sdk/tools-notes.html">SDK Tools, Revision 3</a>
+      <li><a href="<?cs var:toroot ?>sdk/tools-notes.html">SDK Tools, r3</a>
+      <span class="new">new!</span>
+      </li>
+      <li><a href="<?cs var:toroot ?>sdk/win-usb.html">USB Driver for
+Windows, r2</a>
       <span class="new">new!</span>
       </li>
     </ul>
diff --git a/docs/html/sdk/win-usb.jd b/docs/html/sdk/win-usb.jd
new file mode 100644
index 0000000..3a5a30f
--- /dev/null
+++ b/docs/html/sdk/win-usb.jd
@@ -0,0 +1,200 @@
+page.title=USB Driver for Windows
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+  <h2>In this document</h2>
+  <ol>
+    <li><a href="#RevisionNotes">Revision Notes</a></li>
+    <li><a href="#WinUsbDriver">Installing the USB Driver for Windows</a></li>
+  </ol>
+  <h2>See also</h2>
+  <ol>
+    <li><a
+    href="{@docRoot}guide/developing/device.html">Developing on a
+    Device</a></li>
+    <li><a
+    href="adding-components.html">Adding SDK Components</a></li>
+  </ol>
+</div>
+</div>
+
+<p>The USB driver for Windows is a downloadable component for the
+Android SDK. If you are developing on Windows and would like to
+connect an Android-powered device to test your applications, then you will need
+to install the USB driver.</p>
+
+<p>This document provides information about the latest version of the
+USB driver and a guide to installing the driver on your development
+computer.</p>
+
+<p class="note"><strong>Note:</strong>
+If you're developing on Mac OS X or Linux, then you do not need to install a
+USB driver. Refer to <a
+href="{@docRoot}guide/developing/device.html#setting-up">Setting up a
+Device</a> to start development with a device.</p>
+
+<h2 id="RevisionNotes">Revision Notes</h2>
+
+<h4>Revision 2</h4>
+<p>Adds support for the Verizon Droid (or similar hardware on
+other carriers). Released November 2009.</p>
+
+<h4>Revision 1</h4>
+<p>This was the initial release of the WinUsb-based driver, with support
+for the T-Mobile G1 and myTouch 3G (and similar devices).</p>
+
+<h2 id="WinUsbDriver">Installing the USB Driver for Windows</h2>
+
+<div class="sidebox-wrapper">
+<div class="sidebox-inner">
+  <p>The USB driver for Windows provides support for the following
+Android-powered
+devices:</p>
+  <ul>
+    <li>T-Mobile G1* / ADP1</li>
+    <li>T-Mobile myTouch 3G* / Google Ion</li>
+    <li>Verizon Droid*</li>
+  </ul>
+  <p>* <em>Or similar hardware on other carriers</em></p>
+  <p>Any additional devices will require Windows drivers provided by
+the hardware manufacturer.</p>
+</div>
+</div>
+
+<p>Before you perform the installation below, you must have the USB
+driver saved to your development computer. To get the USB driver, use
+the AVD and SDK Manager included with the SDK Tools to download the USB driver
+as an SDK component. For more information, read <a
+href="adding-components.html">Adding SDK Components</a>.</p>
+
+<p>Once you have the USB driver saved to your computer, select the
+appropriate procedure below, based on your operating system and whether you're
+installing for the first time or upgrading.</p>
+
+<p>If you are connecting an Android-powered
+device to your computer for the first time, follow the below procedure to
+"Perform a fresh installation." If you have installed one of the older
+USB drivers and would like to upgrade to the latest version, follow the
+procedure to "Upgrade an existing driver."</p>
+
+<p>Once you've completed the USB driver installation,
+please see <a
+href="{@docRoot}guide/developing/device.html">Developing on a Device</a> for
+other important information about using an Android-powered device for
+development.</p>
+
+<ol class="nolist">
+  <li><strong>Windows Vista:</strong>
+    <ol class="nolist">
+      <li><a href="#VistaFreshInstall">Perform a fresh installation</a></li>
+      <li><a href="#VistaUprade">Upgrade an existing driver</a></li>
+    </ol>
+  </li>
+  <li><strong>Windows XP:</strong>
+    <ol class="nolist">
+      <li><a href="#XPFreshInstall">Perform a fresh installation</a></li>
+      <li><a href="#XPUpgrade">Upgrade an existing driver</a></li>
+    </ol>
+  </li>
+</ol>
+
+
+<p class="caution"><strong>Caution:</strong>
+You may make changes to <code>android_winusb.inf</code> file found inside
+<code>usb_driver\</code> (for example, to add support for other devices),
+however, this will lead to security warnings when you install or upgrade the
+driver. Making any other changes to the driver files may break the installation
+process.</p>
+
+<h3 id="VistaFreshInstall">Windows Vista: Perform a fresh installation</h3>
+
+<p>To install the Android USB driver on Windows Vista for the first time:</p>
+
+<ol>
+  <li>Connect your Android-powered device to your computer's USB port. Windows
+  will detect the device and launch the Found New Hardware wizard.</li>
+  <li>Select "Locate and install driver software."</li>
+  <li>Select "Don't search online."</li>
+  <li>Select "I don't have the disk. Show me other options."</li>
+  <li>Select "Browse my computer for driver software."</li>
+  <li>Click "Browse..." and locate the folder where you copied the
+    installation package. As long as you specified the exact location of the 
+    installation package, you may leave "Include subfolders" checked or
+  unchecked&mdash;it doesn't matter.</li>
+  <li>Click "Next." Vista may prompt you to confirm the privilege elevation
+  required for driver installation. Confirm it.</li>
+  <li>When Vista asks if you'd like to install the Google ADB Interface device,
+  click "Install" to install the driver.</li>
+</ol>
+
+
+<h3 id="VistaUpgrade">Windows Vista: Upgrade an existing driver</h3>
+
+<p>To upgrade an existing Android USB driver on Windows Vista with the new
+driver:</p>
+
+<ol>
+  <li>Connect your Android-powered device to your computer's USB port.</li>
+  <li>Right-click on "Computer" from your desktop or Windows Explorer,
+    and select "Manage."</li>
+  <li>Select "Device Manager" in the left pane of the Computer Management
+  window.</li>
+  <li>Locate and expand "ADB Interface" in the right pane.</li>
+  <li>Right-click on "HTC Dream Composite ADB Interface", and select "Update
+  Driver Software..."</li>
+  <li>When Vista starts updating the driver, a prompt will ask how you want to
+  search for the driver
+    software. Select "Browse my computer for driver software."</li>
+  <li>Click "Browse..." and locate the folder where you copied the
+    installation package. As long as you specified the exact location of the 
+    installation package, you may leave "Include subfolders" checked or
+    unchecked&mdash;it doesn't matter.</li>
+  <li>Click "Next." Vista may prompt you to confirm the privilege elevation
+  required for driver installation. Confirm it.</li>
+  <li>When Vista asks if you'd like to install the Google ADB Interface device,
+  click "Install" to install the driver.</li>
+</ol>
+
+
+<h3 id="XPFreshInstall">Windows XP: Perform a fresh installation</h3>
+
+<p>To install the Android USB driver on Windows XP for the first time:</p>
+
+<ol>
+  <li>Connect your Android-powered device to your computer's USB port. Windows 
+    will detect the device and launch the Hardware Update Wizard.</li>
+  <li>Select "Install from a list or specific location" and click
+    "Next."</li>
+  <li>Select "Search for the best driver in these locations"; un-check "Search
+    removable media"; and check "Include this location in the search."</li>
+  <li>Click "Browse..." and locate the folder where you copied the installation 
+    package.</li>
+  <li>Click "Next" to install the driver.</li>
+</ol>
+
+
+<h3 id="XPUpgrade">Windows XP: Upgrade an existing driver</h3>
+
+<p>To upgrade an existing Android USB driver on Windows XP with the new
+driver:</p>
+
+<ol>
+  <li>Connect your Android-powered device to your computer's USB port.</li>
+  <li>Right-click on "My Computer" from your desktop or Windows Explorer,
+    and select "Manage."</li>
+  <li>Select "Device Manager" in the left pane of the Computer Management
+  window.</li>
+  <li>Locate and expand "Android Phone" in the right pane.</li>
+  <li>Right-click "Android Composite ADB Interface" and select "Update
+  Driver..."
+    This will launch the Hardware Update Wizard.</li>
+  <li>Select "Install from a list or specific location" and click
+    "Next."</li>
+  <li>Select "Search for the best driver in these locations"; un-check "Search
+    removable media"; and check "Include this location in the search."</li>
+  <li>Click "Browse..." and locate the folder where you copied the installation 
+    package.</li>
+  <li>Click "Next" to install the driver.</li>
+</ol>
+  
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 2e1cf56..af93d36 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -212,8 +212,12 @@
     private volatile boolean mPokeAwakeOnSet = false;
     private volatile boolean mInitComplete = false;
     private HashMap<IBinder,PokeLock> mPokeLocks = new HashMap<IBinder,PokeLock>();
+    // mScreenOnTime and mScreenOnStartTime are used for computing total time screen
+    // has been on since boot
     private long mScreenOnTime;
     private long mScreenOnStartTime;
+    // mLastScreenOnTime is the time the screen was last turned on
+    private long mLastScreenOnTime;
     private boolean mPreventScreenOn;
     private int mScreenBrightnessOverride = -1;
     private boolean mUseSoftwareAutoBrightness;
@@ -222,6 +226,7 @@
     private int[] mLcdBacklightValues;
     private int[] mButtonBacklightValues;
     private int[] mKeyboardBacklightValues;
+    private int mLightSensorWarmupTime;
 
     // Used when logging number and duration of touch-down cycles
     private long mTotalTouchDownTime;
@@ -456,6 +461,8 @@
                     com.android.internal.R.array.config_autoBrightnessButtonBacklightValues);
             mKeyboardBacklightValues = resources.getIntArray(
                     com.android.internal.R.array.config_autoBrightnessKeyboardBacklightValues);
+            mLightSensorWarmupTime = resources.getInteger(
+                    com.android.internal.R.integer.config_lightSensorWarmupTime);
         }
 
        ContentResolver resolver = mContext.getContentResolver();
@@ -886,6 +893,7 @@
         pw.println("  mPreventScreenOn=" + mPreventScreenOn
                 + "  mScreenBrightnessOverride=" + mScreenBrightnessOverride);
         pw.println("  mTotalDelaySetting=" + mTotalDelaySetting);
+        pw.println("  mLastScreenOnTime=" + mLastScreenOnTime);
         pw.println("  mBroadcastWakeLock=" + mBroadcastWakeLock);
         pw.println("  mStayOnWhilePluggedInScreenDimLock=" + mStayOnWhilePluggedInScreenDimLock);
         pw.println("  mStayOnWhilePluggedInPartialLock=" + mStayOnWhilePluggedInPartialLock);
@@ -1299,15 +1307,18 @@
 
     private int setScreenStateLocked(boolean on) {
         int err = Power.setScreenState(on);
-        if (err == 0 && mUseSoftwareAutoBrightness) {
-            enableLightSensor(on);
-            if (!on) {
-                // make sure button and key backlights are off too
-                mHardware.setLightBrightness_UNCHECKED(HardwareService.LIGHT_ID_BUTTONS, 0);
-                mHardware.setLightBrightness_UNCHECKED(HardwareService.LIGHT_ID_KEYBOARD, 0);
-                // clear current value so we will update based on the new conditions
-                // when the sensor is reenabled.
-                mLightSensorValue = -1;
+        if (err == 0) {
+            mLastScreenOnTime = (on ? SystemClock.elapsedRealtime() : 0);
+            if (mUseSoftwareAutoBrightness) {
+                enableLightSensor(on);
+                if (!on) {
+                    // make sure button and key backlights are off too
+                    mHardware.setLightBrightness_UNCHECKED(HardwareService.LIGHT_ID_BUTTONS, 0);
+                    mHardware.setLightBrightness_UNCHECKED(HardwareService.LIGHT_ID_KEYBOARD, 0);
+                    // clear current value so we will update based on the new conditions
+                    // when the sensor is reenabled.
+                    mLightSensorValue = -1;
+                }
             }
         }
         return err;
@@ -2431,13 +2442,15 @@
         public void onSensorChanged(SensorEvent event) {
             synchronized (mLocks) {
                 int value = (int)event.values[0];
+                long milliseconds = event.timestamp / 1000000;
                 if (mDebugLightSensor) {
                     Log.d(TAG, "onSensorChanged: light value: " + value);
                 }
                 mHandler.removeCallbacks(mAutoBrightnessTask);
                 if (mLightSensorValue != value) {
-                    if (mLightSensorValue == -1) {
-                        // process the value immediately
+                    if (mLightSensorValue == -1 ||
+                            milliseconds < mLastScreenOnTime + mLightSensorWarmupTime) {
+                        // process the value immediately if screen has just turned on
                         lightSensorChangedLocked(value);
                     } else {
                         // delay processing to debounce the sensor