Merge change I0f9a53d4 into eclair

* changes:
  Set metadata retriever thread group to the caller's group.
diff --git a/Android.mk b/Android.mk
index a33ef38..a83d497 100644
--- a/Android.mk
+++ b/Android.mk
@@ -345,6 +345,7 @@
     -since ./frameworks/base/api/3.xml 3 \
     -since ./frameworks/base/api/4.xml 4 \
     -since ./frameworks/base/api/5.xml 5 \
+    -since ./frameworks/base/api/6.xml 6 \
 		-error 1 -error 2 -warning 3 -error 4 -error 6 -error 8 \
 		-overview $(LOCAL_PATH)/core/java/overview.html
 
@@ -373,7 +374,7 @@
 
 ## SDK version identifiers used in the published docs
   # major[.minor] version for current SDK. (full releases only)
-framework_docs_SDK_VERSION:=2.0
+framework_docs_SDK_VERSION:=2.0.1
   # release version (ie "Release x")  (full releases only)
 framework_docs_SDK_REL_ID:=1
   # name of current SDK directory (full releases only)
@@ -382,10 +383,10 @@
 framework_docs_SDK_PREVIEW:=0
 
 ## Latest ADT version identifiers, for reference from published docs
-framework_docs_ADT_VERSION:=0.9.4
-framework_docs_ADT_DOWNLOAD:=ADT-0.9.4.zip
-framework_docs_ADT_BYTES:=3367536
-framework_docs_ADT_CHECKSUM:=4cdecd72b3e28022d8a55891f13e7d43
+framework_docs_ADT_VERSION:=0.9.5
+framework_docs_ADT_DOWNLOAD:=ADT-0.9.5.zip
+framework_docs_ADT_BYTES:=3372982
+framework_docs_ADT_CHECKSUM:=227ec538359fbe417ccde7f0ad614a96
 
 framework_docs_LOCAL_DROIDDOC_OPTIONS += \
 		-hdf sdk.version $(framework_docs_SDK_VERSION) \
@@ -440,6 +441,7 @@
 LOCAL_DROIDDOC_OPTIONS:=\
 		$(framework_docs_LOCAL_DROIDDOC_OPTIONS) \
                 $(web_docs_sample_code_flags) \
+                -offlinemode \
 		-title "Android SDK" \
 		-proofread $(OUT_DOCS)/$(LOCAL_MODULE)-proofread.txt \
 		-todo $(OUT_DOCS)/$(LOCAL_MODULE)-docs-todo.html \
diff --git a/core/java/android/provider/Checkin.java b/core/java/android/provider/Checkin.java
index 84753ee..4134dc29 100644
--- a/core/java/android/provider/Checkin.java
+++ b/core/java/android/provider/Checkin.java
@@ -74,6 +74,7 @@
             CARRIER_BUG_REPORT,
             CHECKIN_FAILURE,
             CHECKIN_SUCCESS,
+            CPUFREQ_STATS,
             FOTA_BEGIN,
             FOTA_FAILURE,
             FOTA_INSTALL,
diff --git a/core/java/com/android/internal/widget/DigitalClock.java b/core/java/com/android/internal/widget/DigitalClock.java
index ca71722..fa47ff6 100644
--- a/core/java/com/android/internal/widget/DigitalClock.java
+++ b/core/java/com/android/internal/widget/DigitalClock.java
@@ -61,7 +61,12 @@
                             Intent.ACTION_TIMEZONE_CHANGED)) {
                     mCalendar = Calendar.getInstance();
                 }
-                updateTime();
+                // Post a runnable to avoid blocking the broadcast.
+                mHandler.post(new Runnable() {
+                        public void run() {
+                            updateTime();
+                        }
+                });
             }
         };
 
@@ -133,7 +138,7 @@
             filter.addAction(Intent.ACTION_TIME_TICK);
             filter.addAction(Intent.ACTION_TIME_CHANGED);
             filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
-            mContext.registerReceiver(mIntentReceiver, filter, null, mHandler);
+            mContext.registerReceiver(mIntentReceiver, filter);
         }
 
         /* monitor 12/24-hour display preference */
diff --git a/data/sounds/AudioPackage4.mk b/data/sounds/AudioPackage4.mk
index 354002a..6c36bad 100644
--- a/data/sounds/AudioPackage4.mk
+++ b/data/sounds/AudioPackage4.mk
@@ -20,7 +20,11 @@
 	$(LOCAL_PATH)/Alarm_Beep_03.ogg:system/media/audio/alarms/Alarm_Beep_03.ogg \
 	$(LOCAL_PATH)/Alarm_Rooster_02.ogg:system/media/audio/alarms/Alarm_Rooster_02.ogg \
 	$(LOCAL_PATH)/notifications/Beat_Box_Android.ogg:system/media/audio/notifications/Beat_Box_Android.ogg \
+	$(LOCAL_PATH)/notifications/Cricket.ogg:system/media/audio/notifications/Cricket.ogg \
+	$(LOCAL_PATH)/notifications/Doink.ogg:system/media/audio/notifications/Doink.ogg \
+	$(LOCAL_PATH)/notifications/Drip.ogg:system/media/audio/notifications/Drip.ogg \
 	$(LOCAL_PATH)/notifications/Heaven.ogg:system/media/audio/notifications/Heaven.ogg \
+	$(LOCAL_PATH)/notifications/SpaceSeed.ogg:system/media/audio/notifications/SpaceSeed.ogg \
 	$(LOCAL_PATH)/notifications/TaDa.ogg:system/media/audio/notifications/TaDa.ogg \
 	$(LOCAL_PATH)/notifications/Tinkerbell.ogg:system/media/audio/notifications/Tinkerbell.ogg \
 	$(LOCAL_PATH)/newwavelabs/CaffeineSnake.ogg:system/media/audio/notifications/CaffeineSnake.ogg \
diff --git a/data/sounds/notifications/Cricket.ogg b/data/sounds/notifications/Cricket.ogg
new file mode 100644
index 0000000..47b3868
--- /dev/null
+++ b/data/sounds/notifications/Cricket.ogg
Binary files differ
diff --git a/data/sounds/notifications/Cricket.wav b/data/sounds/notifications/Cricket.wav
new file mode 100644
index 0000000..0a1d1db
--- /dev/null
+++ b/data/sounds/notifications/Cricket.wav
Binary files differ
diff --git a/data/sounds/notifications/Doink.ogg b/data/sounds/notifications/Doink.ogg
new file mode 100644
index 0000000..b8b7181
--- /dev/null
+++ b/data/sounds/notifications/Doink.ogg
Binary files differ
diff --git a/data/sounds/notifications/Doink.wav b/data/sounds/notifications/Doink.wav
new file mode 100644
index 0000000..b0d37c4
--- /dev/null
+++ b/data/sounds/notifications/Doink.wav
Binary files differ
diff --git a/data/sounds/notifications/Drip.ogg b/data/sounds/notifications/Drip.ogg
new file mode 100644
index 0000000..2981758
--- /dev/null
+++ b/data/sounds/notifications/Drip.ogg
Binary files differ
diff --git a/data/sounds/notifications/Drip.wav b/data/sounds/notifications/Drip.wav
new file mode 100644
index 0000000..eeb889e
--- /dev/null
+++ b/data/sounds/notifications/Drip.wav
Binary files differ
diff --git a/data/sounds/notifications/SpaceSeed.ogg b/data/sounds/notifications/SpaceSeed.ogg
new file mode 100644
index 0000000..e69024d
--- /dev/null
+++ b/data/sounds/notifications/SpaceSeed.ogg
Binary files differ
diff --git a/data/sounds/notifications/SpaceSeed.wav b/data/sounds/notifications/SpaceSeed.wav
new file mode 100644
index 0000000..d209645
--- /dev/null
+++ b/data/sounds/notifications/SpaceSeed.wav
Binary files differ
diff --git a/docs/html/guide/appendix/api-levels.jd b/docs/html/guide/appendix/api-levels.jd
index cebd2d4..5487487 100644
--- a/docs/html/guide/appendix/api-levels.jd
+++ b/docs/html/guide/appendix/api-levels.jd
@@ -83,6 +83,7 @@
 
 <table>
   <tr><th>Platform Version</th><th>API Level</th></tr>
+  <tr><td>Android 2.0.1</td><td>6</td></tr>
   <tr><td>Android 2.0</td><td>5</td></tr>
   <tr><td>Android 1.6</td><td>4</td></tr>
   <tr><td>Android 1.5</td><td>3</td></tr>
@@ -111,7 +112,7 @@
 <p>Applications can use a manifest element provided by the framework API &mdash;
 <code>&lt;uses-sdk&gt;</code> &mdash; to describe the minimum and maximum API
 Levels under which they are able to run, as well as the preferred API Level that
-they are designed to support. The element offers two key attributes:</p>
+they are designed to support. The element offers three key attributes:</p>
 
 <ul>
 <li><code>android:minSdkVersion</code> &mdash; Specifies the minimum API Level
diff --git a/docs/html/guide/developing/tools/layoutopt.jd b/docs/html/guide/developing/tools/layoutopt.jd
index 72a110d..f7c3d77 100644
--- a/docs/html/guide/developing/tools/layoutopt.jd
+++ b/docs/html/guide/developing/tools/layoutopt.jd
@@ -45,7 +45,7 @@
    11:17 This LinearLayout layout or its FrameLayout parent is useless</pre>
 
 <p>The <code>layoutopt</code> tool is available in SDK Tools, Revision 3 or
-later. If you do not have SDK Tools 3 or later installed in your SDK, you can
+later. If you do not have SDK Tools r3 or later installed in your SDK, you can
 download it from the Android SDK repository site using the Android SDK and AVD
 Manager. For information, see <a
 href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>.</p>
diff --git a/docs/html/guide/practices/screens_support.jd b/docs/html/guide/practices/screens_support.jd
index 88975f8..10f4485 100644
--- a/docs/html/guide/practices/screens_support.jd
+++ b/docs/html/guide/practices/screens_support.jd
@@ -700,9 +700,7 @@
 example, if your application is designed to run on both Android 1.5 (API Level
 3) and Android 1.6 (API Level 4 and higher), you can use the <code>-v4</code>
 qualifier to tag any resources that should be excluded when your application is
-running on Android 1.5 (API Level 3). Using the version qualifier is necessary
-in some cases, if the older platform is inadvertently loading resources from a
-directory containing resources for a newer platform. </td>
+running on Android 1.5 (API Level 3).  </td>
 </tr>
 </table>
 
diff --git a/docs/html/sdk/RELEASENOTES.jd b/docs/html/sdk/RELEASENOTES.jd
index cbfac2b..fdaba61 100644
--- a/docs/html/sdk/RELEASENOTES.jd
+++ b/docs/html/sdk/RELEASENOTES.jd
@@ -28,16 +28,16 @@
 
 <p>Note that if you are currently using the Android 1.6 SDK, you do not
 necessarily need to install the new SDK, since your existing SDK already
-includes the Android SDK and AVD Manager tool. To develop against Android 2.0,
-for example, you could just download the Android 2.0 platform into your existing
+includes the Android SDK and AVD Manager tool. To develop against Android 2.0.1,
+for example, you could just download the Android 2.0.1 platform into your existing
 SDK. </p>
 
 <p>Release notes for Android platforms and other SDK components are
 now available from the "SDK" tab, under "Downloadable SDK Components."</p>
 
 <ul>
-<li>Notes for the Android 2.0 platform are in the <a
-href="{@docRoot}sdk/android-2.0.html">Android 2.0, Release 1</a> document. </li>
+<li>Notes for the Android 2.0.1 platform are in the <a
+href="{@docRoot}sdk/android-2.0.1.html">Android 2.0.1, Release 1</a> document. </li>
 <li>You can find information about tools changes in the <a
 href="{@docRoot}sdk/tools-notes.html">SDK Tools Notes</a> and <a
 href="{@docRoot}sdk/adt-notes.html">ADT Plugin Notes</a>.</li>
diff --git a/docs/html/sdk/adt-notes.jd b/docs/html/sdk/adt-notes.jd
index 639d5e8..361d99a 100644
--- a/docs/html/sdk/adt-notes.jd
+++ b/docs/html/sdk/adt-notes.jd
@@ -16,16 +16,40 @@
 feature. For more information, see <a
 href="{@docRoot}sdk/eclipse-adt.html">Installing and Updating ADT</a>. </p>
 
-<h2 id="0.9.4">ADT 0.9.4</h2>
 
-<p>ADT 0.9.4 provides several new features for developers, as described below.
+<h2 id="0.9.5">ADT 0.9.5</h2>
+
+<p>December 2009. ADT 0.9.5 provides several bug fixes for developers, 
+as described below.
 </p>
 
 <h3>Dependencies</h3>
 
-<p>ADT 0.9.4 requires features provided in SDK Tools, Revision 3. If you install
+<p>ADT 0.9.5 requires features provided in SDK Tools r4. If you install
+ADT 0.9.5, which is highly recommended, you should use the Android SDK and AVD
+Manager to download SDK Tools r4 or higher into your SDK. For more information,
+see <a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>.
+</p>
+
+<h3>General Notes</h3>
+<ul>
+<li>AVD Launch dialog now shows scale value.</li>
+<li>Fixes potential NPE in SDK Manager on AVD launch, for older AVD with no skin name specified.</li>
+<li>Fixes XML validation issue in on older Java versions.</li>
+<li>.apk packaging now properly ignores vi swap files as well as hidden files.</li>
+</ul>
+
+
+<h2 id="0.9.4">ADT 0.9.4</h2>
+
+<p>October 2009. ADT 0.9.4 provides several new features for developers, as described below.
+</p>
+
+<h3>Dependencies</h3>
+
+<p>ADT 0.9.4 requires features provided in SDK Tools, revision 3. If you install
 ADT 0.9.4, which is highly recommended, you should use the Android SDK and AVD
-Manager to download SDK Tools 3 or higher into your SDK. For more information,
+Manager to download SDK Tools r3 or higher into your SDK. For more information,
 see <a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>.
 </p>
 
diff --git a/docs/html/sdk/adt_download.jd b/docs/html/sdk/adt_download.jd
index 6ce7634..6dbca48 100644
--- a/docs/html/sdk/adt_download.jd
+++ b/docs/html/sdk/adt_download.jd
@@ -22,10 +22,17 @@
     <th>Notes</th>
   </tr>
   <tr>
-     <td>0.9.4</td>
-     <td><a href="http://dl-ssl.google.com/android/ADT-0.9.4.zip">ADT-0.9.4.zip</a></td>
+     <td>0.9.5</td>
+     <td><a href="http://dl-ssl.google.com/android/ADT-0.9.5.zip">ADT-0.9.5.zip</a></td>
      <td><nobr>{@adtZipBytes} bytes</nobr></td>
      <td>{@adtZipChecksum}</td>
+     <td>Requires SDK Tools, Revision 4 <em><nobr>December 2009</nobr></em></td>
+  </tr>
+  <tr>
+     <td>0.9.4</td>
+     <td><a href="http://dl-ssl.google.com/android/ADT-0.9.4.zip">ADT-0.9.4.zip</a></td>
+     <td><nobr>3367536 bytes</nobr></td>
+     <td>4cdecd72b3e28022d8a55891f13e7d43</td>
      <td>Requires SDK Tools, Revision 3 <em><nobr>October 2009</nobr></em></td>
   </tr>
   <tr>
diff --git a/docs/html/sdk/android-1.6.jd b/docs/html/sdk/android-1.6.jd
index 4b659a1a..646b61d 100644
--- a/docs/html/sdk/android-1.6.jd
+++ b/docs/html/sdk/android-1.6.jd
@@ -1,8 +1,8 @@
-page.title=Android 1.6, Release 1
+page.title=Android 1.6, Release 2
 sdk.platform.version=1.6
 sdk.platform.apiLevel=4
 sdk.platform.majorMinor=minor
-sdk.platform.releaseDate=September 2009
+sdk.platform.releaseDate=December 2009
 sdk.platform.deployableDate=October 2009
 
 @jd:body
@@ -13,6 +13,7 @@
   <h2>In this document</h2>
   <ol>
 	<li><a href="#features">Platform Highlights</a></li>
+	<li><a href="#releases">Release Notes</a></li>
 	<li><a href="#apps">Built-in Applications</a></li>
 	<li><a href="#locs">Locales</a></li>
 	<li><a href="#skins">Emulator Skins</a></li>
@@ -37,20 +38,21 @@
 <em>API Level:</em>&nbsp;<strong>{@sdkPlatformApiLevel}</strong></p>
 
 <p>Android {@sdkPlatformVersion} is a {@sdkPlatformMajorMinor} platform release
-deployable to Android-powered handsets starting in {@sdkPlatformDeployableDate}.
-The release includes new features for users and developers, as well as changes
+deployable to Android-powered handsets since {@sdkPlatformDeployableDate}.
+The platform includes new features for users and developers, as well as changes
 in the Android framework API. </p>
 
-<p>For developers, the Android {@sdkPlatformVersion} platform is available as a
-downloadable component for the Android SDK. The downloadable platform includes a
-fully compliant Android library and system image, as well as a set of emulator
-skins, sample applications, and more. The downloadable platform is fully
-compliant and includes no external libraries. </p>
+<p>For developers, a new release of the Android {@sdkPlatformVersion} platform
+is available as a downloadable component for the Android SDK. The platform
+&mdash; Android 1.6 r2 &mdash; includes a fully compliant Android library and
+system image, as well as a set of emulator skins, sample applications, and minor
+development updates. The downloadable platform is fully compliant (API Level 4)
+and includes no external libraries.</p>
 
 <p>To get started developing or testing against the Android
 {@sdkPlatformVersion} platform, use the Android SDK and AVD Manager tool to
-download the platform into your Android 1.6 or later SDK. For more information,
-see <a href="{@docRoot}sdk/adding-components.html">Adding SDK
+download the latest Android 1.6 platform into your Android 1.6 or later SDK. For
+more information, see <a href="{@docRoot}sdk/adding-components.html">Adding SDK
 Components</a>.</p>
 
 
@@ -61,6 +63,45 @@
 {@sdkPlatformVersion} Platform Highlights</a> document.</p>
 
 
+<h2 id="relnotes">Release Notes</h2>
+
+<p>The sections below provide information about the available releases of the 
+Android 1.6 platform.</p>
+
+<h3>Android 1.6, Release 2</h3>
+
+<p>December 2009. Requires SDK Tools r4 or higher.</p>
+
+<p>API related:</p>
+<ul>
+<li>Properly exposes CDMA-related constants {@link android.telephony.TelephonyManager}: <code>DATA_ACTIVITY_DORMANT</code>,
+<code>PHONE_TYPE_CDMA</code>, <code>NETWORK_TYPE_CDMA</code>,
+<code>NETWORK_TYPE_EVDO_0</code>, <code>NETWORK_TYPE_EVDO_A</code>, and
+<code>NETWORK_TYPE_1xRTT</code>.</li>
+</ul>
+<p>System image:</p>
+<ul>
+<li>Fixes bug so that Bitmap's density is now propagated through Parcelable.</li>
+<li>Fixes NinePatchDrawable to properly scale its reported padding for compatibility mode.</li>
+<li>Fixes TextView to properly compute styled font metrics based on the screen density.</li>
+<li>Updates kernel to 2.6.29, to match kernel on commercially
+available Android-powered devices.</li>
+</ul>
+<p>Tools:</p>
+<ul>
+<li>Adds new Ant build system with support for Emma instrumentation projects
+(code coverage).</li>
+<li>Fixes emulator skins to properly emulate d-pad in landscape mode.</li>
+<li>Fixes density rendering in the layout editor in ADT.</li>
+</ul>
+
+
+
+<h3>Android 1.6, Release 1</h3>
+
+<p>September 2009. Initial release. Requires SDK Tools r3 or higher.</p>
+
+
 <h2 id="apps">Built-in Applications</h2>
 
 <p>The system image included in the downloadable platform provides these
diff --git a/docs/html/sdk/index.jd b/docs/html/sdk/index.jd
index f467492..fd0576a 100644
--- a/docs/html/sdk/index.jd
+++ b/docs/html/sdk/index.jd
@@ -1,19 +1,19 @@
 page.title=Android SDK
 sdk.redirect=0
-sdk.version=2.0
-sdk.date=October 2009
+sdk.version=2.0.1
+sdk.date=December 2009
 
-sdk.win_download=android-sdk_r3-windows.zip
-sdk.win_bytes=23070805
-sdk.win_checksum=bd7b57d5df37bd55ea101e76b24260a8
+sdk.win_download=android-sdk_r4-windows.zip
+sdk.win_bytes=23069119
+sdk.win_checksum=c48b407de852ba483869f17337e90997
 
-sdk.mac_download=android-sdk_r3-mac.zip
-sdk.mac_bytes=19653431
-sdk.mac_checksum=f6674bf45e5e36811eea7e584f0c1d67
+sdk.mac_download=android-sdk_r4-mac.zip
+sdk.mac_bytes=19657927
+sdk.mac_checksum=b08512765aa9b0369bb9b8fecdf763e3
 
-sdk.linux_download=android-sdk_r3-linux.tgz
-sdk.linux_bytes=15986291
-sdk.linux_checksum=3e1534e7fc15d154ff81616f0dc1545c
+sdk.linux_download=android-sdk_r4-linux.tgz
+sdk.linux_bytes=15984887
+sdk.linux_checksum=ef84b08fd9da84f4c4ae77564fe4eaee
 
 @jd:body
 
diff --git a/docs/html/sdk/sdk_toc.cs b/docs/html/sdk/sdk_toc.cs
index 589cd63..1690995 100644
--- a/docs/html/sdk/sdk_toc.cs
+++ b/docs/html/sdk/sdk_toc.cs
@@ -64,8 +64,8 @@
       <li><a href="<?cs var:toroot ?>sdk/android-2.0.1.html">Android 2.0.1
         Platform</a> <span class="new">new!</span>
       </li>
-      <li><a href="<?cs var:toroot ?>sdk/android-1.6.html">Android 1.6
-Platform</a></li>
+      <li><a href="<?cs var:toroot ?>sdk/android-1.6.html">Android 1.6 
+        Platform</a> <span class="new">new!</span></li>
       <li><a href="<?cs var:toroot ?>sdk/android-1.5.html">Android 1.5 Platform</a></li>
       <li class="toggle-list">
         <div><a href="#" onclick="toggle(this.parentNode.parentNode,true); return false;">Older Platforms</a></div>
@@ -79,12 +79,11 @@
       </li>
     </ul>
     <ul>
-      <li><a href="<?cs var:toroot ?>sdk/tools-notes.html">SDK Tools, r3</a>
+      <li><a href="<?cs var:toroot ?>sdk/tools-notes.html">SDK Tools, r4</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>
   </li>
@@ -109,10 +108,8 @@
       <span style="display:none" class="zh-CN"></span>
       <span style="display:none" class="zh-TW"></span></a>
       </li>
-      </ul>
-      <ul>
       <li><a href="<?cs var:toroot ?>sdk/adt-notes.html">ADT <?cs var:adt.zip.version ?> 
-          <span class="new">new!</span></span></a>
+          <span class="new">new!</span></a>
       </li>
     </ul>
   </li>
@@ -160,4 +157,4 @@
     changeNavLang(getLangPref());
 //-->
 </script>
-<?cs /if ?>
\ No newline at end of file
+<?cs /if ?>
diff --git a/docs/html/sdk/tools-notes.jd b/docs/html/sdk/tools-notes.jd
index b8337b0..1b0d8f0 100644
--- a/docs/html/sdk/tools-notes.jd
+++ b/docs/html/sdk/tools-notes.jd
@@ -15,18 +15,55 @@
 existing tools), use the Android SDK and AVD Manager. For more information, see
 <a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>. </p>
 
+<h2 id="4">SDK Tools, Revision 4</h2>
+
+<p>December 2009. SDK Tools r4 provides several new features for developers and includes
+fixes for several issues, as described below. </p>
+
+<h3>Dependencies</h3>
+
+<p>SDK Tools r4 is compatible with ADT 0.9.5 and later, but not
+compatible with earlier versions. If you are developing in Eclipse with ADT, you
+<strong>must</strong> update your ADT plugin to version 0.9.5 or higher if you
+install SDK Tools r4 in your SDK. </p>
+
+<h3>General notes</h3>
+<ul>
+<li>Launcher script now forces GDK_NATIVE_WINDOW=true (linux only), to fix a 
+compatibility issue between GTK and SWT.</li>
+</ul>
+
+<h3>Android SDK and AVD Manager</h3>
+<ul>
+<li>AVD Launch dialog now shows scale value.</li>
+<li>Fixes potential NPE in SDK Manager on AVD launch, for older AVD with no 
+skin name specified.</li>
+<li>Fixes XML validation issue in on older Java versions.</li>
+<li>No longer forces the use of Java 1.5 on Mac OS X.</li>
+</ul>
+
+<h3>Emulator</h3>
+<ul>
+<li>No longer limits the size of the system partition.</li>
+</ul>
+
+<h3>Ant build tools</h3>
+<ul>
+<li>.apk packaging now properly ignores vi swap files as well as hidden files.</li>
+</ul>
+
 
 <h2 id="3">SDK Tools, Revision 3</h2>
 
-<p>SDK Tools 3 provides several new features for developers and includes
+<p>October 2009. SDK Tools r3 provides several new features for developers and includes
 fixes for several tools issues, as described below. </p>
 
 <h3>Dependencies</h3>
 
-<p>SDK Tools 3 is compatible with ADT 0.9.4 and later, but not
+<p>SDK Tools r3 is compatible with ADT 0.9.4 and later, but not
 compatible with earlier versions. If you are developing in Eclipse with ADT, you
 <strong>must</strong> update your ADT plugin to version 0.9.4 or higher if you
-install SDK Tools 3 in your SDK. </p>
+install SDK Tools r3 in your SDK. </p>
 
 <h3>Android tool</h3>
 <ul>
@@ -60,7 +97,7 @@
 
 <h3>Layoutopt, a new tool for optimizing layouts</h3>
 
-<p>The SDK Tools 3 package includes <code>layoutopt</code>, a new command-line 
+<p>The SDK Tools r3 package includes <code>layoutopt</code>, a new command-line 
 tool that helps you optimize your layout hierarchies. When run against your 
 layout files, the tool analyzes their hierarchies and notifies you of 
 inefficiencies and other potential issues. The tool also provides simple 
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 408d83f..b71d10c 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -203,7 +203,7 @@
     LOGV("%s allocation ptr=%p mCpuWrite=%i, mCpuRead=%i, mGpuWrite=%i, mGpuRead=%i",
           prefix, mPtr, mCpuWrite, mCpuRead, mGpuWrite, mGpuRead);
 
-    LOGV("%s allocation mIsTexture=%i mIsTextureID=%i, mIsVertexBuffer=%i, mBufferID=%i",
+    LOGV("%s allocation mIsTexture=%i mTextureID=%i, mIsVertexBuffer=%i, mBufferID=%i",
           prefix, mIsTexture, mTextureID, mIsVertexBuffer, mBufferID);
 
 
@@ -400,7 +400,6 @@
         LOGE("Memory allocation failure");
         return NULL;
     }
-    texAlloc->incUserRef();
 
     ElementConverter_t cvt = pickConverter(dst, src);
     cvt(texAlloc->getPtr(), data, w * h);
diff --git a/services/java/com/android/server/HeadsetObserver.java b/services/java/com/android/server/HeadsetObserver.java
index 58fa69e..43de36b 100644
--- a/services/java/com/android/server/HeadsetObserver.java
+++ b/services/java/com/android/server/HeadsetObserver.java
@@ -35,7 +35,7 @@
  */
 class HeadsetObserver extends UEventObserver {
     private static final String TAG = HeadsetObserver.class.getSimpleName();
-    private static final boolean LOG = false;
+    private static final boolean LOG = true;
 
     private static final String HEADSET_UEVENT_MATCH = "DEVPATH=/devices/virtual/switch/h2w";
     private static final String HEADSET_STATE_PATH = "/sys/class/switch/h2w/state";
@@ -43,6 +43,8 @@
 
     private static final int BIT_HEADSET = (1 << 0);
     private static final int BIT_HEADSET_NO_MIC = (1 << 1);
+    private static final int SUPPORTED_HEADSETS = (BIT_HEADSET|BIT_HEADSET_NO_MIC);
+    private static final int HEADSETS_WITH_MIC = BIT_HEADSET;
 
     private int mHeadsetState;
     private int mPrevHeadsetState;
@@ -100,68 +102,76 @@
 
     private synchronized final void update(String newName, int newState) {
         // Retain only relevant bits
-        int headsetState = newState & (BIT_HEADSET|BIT_HEADSET_NO_MIC);
+        int headsetState = newState & SUPPORTED_HEADSETS;
+        int newOrOld = headsetState | mHeadsetState;
+        // reject all suspect transitions: only accept state changes from:
+        // - a: 0 heaset to 1 headset
+        // - b: 1 headset to 0 headset
+        if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
+            return;
+        }
 
-        if (headsetState != mHeadsetState) {
-            boolean isUnplug = false;
-            if (((mHeadsetState & BIT_HEADSET) != 0 && (headsetState & BIT_HEADSET) == 0) ||
-                ((mHeadsetState & BIT_HEADSET_NO_MIC) != 0 && (headsetState & BIT_HEADSET_NO_MIC) == 0)) {
-                isUnplug = true;
-            }
-            mHeadsetName = newName;
-            mPrevHeadsetState = mHeadsetState;
-            mHeadsetState = headsetState;
-            mPendingIntent = true;
+        mHeadsetName = newName;
+        mPrevHeadsetState = mHeadsetState;
+        mHeadsetState = headsetState;
+        mPendingIntent = true;
 
-            if (isUnplug) {
-                Intent intent = new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
-                mContext.sendBroadcast(intent);
+        if (headsetState == 0) {
+            Intent intent = new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
+            mContext.sendBroadcast(intent);
 
-                // It can take hundreds of ms flush the audio pipeline after
-                // apps pause audio playback, but audio route changes are
-                // immediate, so delay the route change by 1000ms.
-                // This could be improved once the audio sub-system provides an
-                // interface to clear the audio pipeline.
-                mWakeLock.acquire();
-                mHandler.sendEmptyMessageDelayed(0, 1000);
-            } else {
-                sendIntent();
-                mPendingIntent = false;
+            // It can take hundreds of ms flush the audio pipeline after
+            // apps pause audio playback, but audio route changes are
+            // immediate, so delay the route change by 1000ms.
+            // This could be improved once the audio sub-system provides an
+            // interface to clear the audio pipeline.
+            mWakeLock.acquire();
+            mHandler.sendEmptyMessageDelayed(0, 1000);
+        } else {
+            sendIntents();
+            mPendingIntent = false;
+        }
+    }
+
+    private synchronized final void sendIntents() {
+        int allHeadsets = SUPPORTED_HEADSETS;
+        for (int curHeadset = 1; allHeadsets != 0; curHeadset <<= 1) {
+            if ((curHeadset & allHeadsets) != 0) {
+                sendIntent(curHeadset);
+                allHeadsets &= ~curHeadset;
             }
         }
     }
 
-    private synchronized final void sendIntent() {
-        //  Pack up the values and broadcast them to everyone
-        Intent intent = new Intent(Intent.ACTION_HEADSET_PLUG);
-        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
-        int state = 0;
-        int microphone = 0;
+    private final void sendIntent(int headset) {
+        if ((mHeadsetState & headset) != (mPrevHeadsetState & headset)) {
+            //  Pack up the values and broadcast them to everyone
+            Intent intent = new Intent(Intent.ACTION_HEADSET_PLUG);
+            intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
+            int state = 0;
+            int microphone = 0;
 
-        if ((mHeadsetState & BIT_HEADSET) != (mPrevHeadsetState & BIT_HEADSET)) {
-            microphone = 1;
-            if ((mHeadsetState & BIT_HEADSET) != 0) {
+            if ((headset & HEADSETS_WITH_MIC) != 0) {
+                microphone = 1;
+            }
+            if ((mHeadsetState & headset) != 0) {
                 state = 1;
             }
-        } else if ((mHeadsetState & BIT_HEADSET_NO_MIC) != (mPrevHeadsetState & BIT_HEADSET_NO_MIC)) {
-            if ((mHeadsetState & BIT_HEADSET_NO_MIC) != 0) {
-                state = 1;
-            }
+            intent.putExtra("state", state);
+            intent.putExtra("name", mHeadsetName);
+            intent.putExtra("microphone", microphone);
+
+            if (LOG) Log.v(TAG, "Intent.ACTION_HEADSET_PLUG: state: "+state+" name: "+mHeadsetName+" mic: "+microphone);
+            // TODO: Should we require a permission?
+            ActivityManagerNative.broadcastStickyIntent(intent, null);
         }
-
-        intent.putExtra("state", state);
-        intent.putExtra("name", mHeadsetName);
-        intent.putExtra("microphone", microphone);
-
-        // TODO: Should we require a permission?
-        ActivityManagerNative.broadcastStickyIntent(intent, null);
     }
 
     private final Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
             if (mPendingIntent) {
-                sendIntent();
+                sendIntents();
                 mPendingIntent = false;
             }
             mWakeLock.release();
diff --git a/services/java/com/android/server/InputDevice.java b/services/java/com/android/server/InputDevice.java
index 6eb6242..7c19f24 100644
--- a/services/java/com/android/server/InputDevice.java
+++ b/services/java/com/android/server/InputDevice.java
@@ -288,6 +288,10 @@
                         + " weight: (" + x + "," + y + ")");
                 mAveragedData[ioff + MotionEvent.SAMPLE_X] = x;
                 mAveragedData[ioff + MotionEvent.SAMPLE_Y] = y;
+                mAveragedData[ioff + MotionEvent.SAMPLE_PRESSURE] =
+                        rawData[ioff + MotionEvent.SAMPLE_PRESSURE];
+                mAveragedData[ioff + MotionEvent.SAMPLE_SIZE] =
+                        rawData[ioff + MotionEvent.SAMPLE_SIZE];
             }
             return mAveragedData;
         }
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 887c46d..bdabca7 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -224,20 +224,22 @@
     /**
      * Condition waited on by {@link #reenableKeyguard} to know the call to
      * the window policy has finished.
+     * This is set to true only if mKeyguardTokenWatcher.acquired() has
+     * actually disabled the keyguard.
      */
-    private boolean mWaitingUntilKeyguardReenabled = false;
+    private boolean mKeyguardDisabled = false;
 
-
-    final TokenWatcher mKeyguardDisabled = new TokenWatcher(
-            new Handler(), "WindowManagerService.mKeyguardDisabled") {
+    final TokenWatcher mKeyguardTokenWatcher = new TokenWatcher(
+            new Handler(), "WindowManagerService.mKeyguardTokenWatcher") {
         public void acquired() {
             mPolicy.enableKeyguard(false);
+            mKeyguardDisabled = true;
         }
         public void released() {
             mPolicy.enableKeyguard(true);
-            synchronized (mKeyguardDisabled) {
-                mWaitingUntilKeyguardReenabled = false;
-                mKeyguardDisabled.notifyAll();
+            synchronized (mKeyguardTokenWatcher) {
+                mKeyguardDisabled = false;
+                mKeyguardTokenWatcher.notifyAll();
             }
         }
     };
@@ -2447,7 +2449,12 @@
             boolean assignLayers = false;
 
             if (imMayMove) {
-                if (moveInputMethodWindowsIfNeededLocked(false)) {
+                if (moveInputMethodWindowsIfNeededLocked(false) || displayed) {
+                    // Little hack here -- we -should- be able to rely on the
+                    // function to return true if the IME has moved and needs
+                    // its layer recomputed.  However, if the IME was hidden
+                    // and isn't actually moved in the list, its layer may be
+                    // out of data so we make sure to recompute it.
                     assignLayers = true;
                 }
             }
@@ -4040,8 +4047,8 @@
             != PackageManager.PERMISSION_GRANTED) {
             throw new SecurityException("Requires DISABLE_KEYGUARD permission");
         }
-        synchronized (mKeyguardDisabled) {
-            mKeyguardDisabled.acquire(token, tag);
+        synchronized (mKeyguardTokenWatcher) {
+            mKeyguardTokenWatcher.acquire(token, tag);
         }
     }
 
@@ -4050,16 +4057,20 @@
             != PackageManager.PERMISSION_GRANTED) {
             throw new SecurityException("Requires DISABLE_KEYGUARD permission");
         }
-        synchronized (mKeyguardDisabled) {
-            mKeyguardDisabled.release(token);
+        synchronized (mKeyguardTokenWatcher) {
+            mKeyguardTokenWatcher.release(token);
 
-            if (!mKeyguardDisabled.isAcquired()) {
-                // if we are the last one to reenable the keyguard wait until
-                // we have actaully finished reenabling until returning
-                mWaitingUntilKeyguardReenabled = true;
-                while (mWaitingUntilKeyguardReenabled) {
+            if (!mKeyguardTokenWatcher.isAcquired()) {
+                // If we are the last one to reenable the keyguard wait until
+                // we have actaully finished reenabling until returning.
+                // It is possible that reenableKeyguard() can be called before
+                // the previous disableKeyguard() is handled, in which case
+                // neither mKeyguardTokenWatcher.acquired() or released() would
+                // be called.  In that case mKeyguardDisabled will be false here
+                // and we have nothing to wait for.
+                while (mKeyguardDisabled) {
                     try {
-                        mKeyguardDisabled.wait();
+                        mKeyguardTokenWatcher.wait();
                     } catch (InterruptedException e) {
                         Thread.currentThread().interrupt();
                     }
@@ -10863,7 +10874,7 @@
 
     public void monitor() {
         synchronized (mWindowMap) { }
-        synchronized (mKeyguardDisabled) { }
+        synchronized (mKeyguardTokenWatcher) { }
         synchronized (mKeyWaiter) { }
     }