Merge change I47ef4266 into eclair

* changes:
  Expose WallpaperSettingsActivity in the public API.
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/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 3fc676b..4684f45 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -126,8 +126,9 @@
      * <p>Notification of the result of this activity is posted using the
      * {@link android.app.Activity#onActivityResult} callback. The
      * <code>resultCode</code>
-     * will be the duration (in seconds) of discoverability, or a negative
-     * value if the user rejected discoverability.
+     * will be the duration (in seconds) of discoverability or
+     * {@link android.app.Activity#RESULT_CANCELED} if the user rejected
+     * discoverability or an error has occurred.
      * <p>Applications can also listen for {@link #ACTION_SCAN_MODE_CHANGED}
      * for global notification whenever the scan mode changes.
      * <p>Requires {@link android.Manifest.permission#BLUETOOTH}
@@ -153,8 +154,9 @@
      * <p>Notification of the result of this activity is posted using the
      * {@link android.app.Activity#onActivityResult} callback. The
      * <code>resultCode</code>
-     * will be negative if the user did not turn on Bluetooth, and non-negative
-     * if Bluetooth has been turned on.
+     * will be {@link android.app.Activity#RESULT_OK} if Bluetooth has been
+     * turned on or {@link android.app.Activity#RESULT_CANCELED} if the user
+     * has rejected the request or an error has occurred.
      * <p>Applications can also listen for {@link #ACTION_STATE_CHANGED}
      * for global notification whenever Bluetooth is turned on or off.
      * <p>Requires {@link android.Manifest.permission#BLUETOOTH}
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/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/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java
index 952eff2..ac27a2d 100644
--- a/opengl/java/android/opengl/GLSurfaceView.java
+++ b/opengl/java/android/opengl/GLSurfaceView.java
@@ -1281,8 +1281,8 @@
         public void start(GLThread thread) throws InterruptedException {
             GLThread oldThread = null;
             synchronized(this) {
-                mMostRecentGLThread = thread;
                 oldThread = mMostRecentGLThread;
+                mMostRecentGLThread = thread;
             }
             if (oldThread != null) {
                 synchronized(oldThread) {
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 270e3cb..2e1cf56 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -91,7 +91,7 @@
     private static final int LONG_DIM_TIME = 7000;              // t+N-5 sec
 
     // How long to wait to debounce light sensor changes.
-    private static final int LIGHT_SENSOR_DELAY = 1000;
+    private static final int LIGHT_SENSOR_DELAY = 2000;
 
     // For debouncing the proximity sensor.
     private static final int PROXIMITY_SENSOR_DELAY = 1000;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java b/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java
index 85840a8..db47693 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java
@@ -846,6 +846,12 @@
             ArrayList<String> fragments = android.telephony.SmsMessage.fragmentText(text1);
             assertEquals(fragments.size(), 1);
         }
+
+        /*
+           This is not a valid test: we will never encode a single-segment
+           EMS message.  Leaving this here, since we may try to support
+           this in the future.
+
         // Valid 160 character GSM text -- the last character is
         // non-ASCII, and so this will currently generate a singleton
         // EMS message, which is not necessarily supported by Verizon.
@@ -860,5 +866,22 @@
             ArrayList<String> fragments = android.telephony.SmsMessage.fragmentText(text2);
             assertEquals(fragments.size(), 1);
         }
+        */
+
+        // *IF* we supported single-segment EMS, this text would result in a
+        // single fragment with 7-bit encoding. But we don't, so this text
+        // results in three fragments of 16-bit encoding.
+        String text2 = "123456789012345678901234567890123456789012345678901234567890" +
+                "1234567890123456789012345678901234567890123456789012345678901234567890" +
+                "12345678901234567890123456789\u00a3";  // Trailing pound-currency sign.
+        ted = SmsMessage.calculateLength(text2, false);
+        assertEquals(3, ted.msgCount);
+        assertEquals(160, ted.codeUnitCount);
+        assertEquals(3, ted.codeUnitSize);
+        if (isCdmaPhone) {
+            ArrayList<String> fragments = android.telephony.SmsMessage.fragmentText(text2);
+            assertEquals(3, fragments.size());
+        }
+
     }
 }