Merge change I24b0a95d into eclair-mr2

* changes:
  The original delay after which we dropped a frame was too aggressive. 40ms lateness seems more appropriate (about 25fps).
diff --git a/Android.mk b/Android.mk
index 732b486..8d13e3b 100644
--- a/Android.mk
+++ b/Android.mk
@@ -347,6 +347,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
 
@@ -375,7 +376,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)
@@ -384,10 +385,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) \
@@ -442,6 +443,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/SubscribedFeeds.java b/core/java/android/provider/SubscribedFeeds.java
deleted file mode 100644
index 8e9f402..0000000
--- a/core/java/android/provider/SubscribedFeeds.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.provider;
-
-import android.content.ContentResolver;
-import android.content.ContentValues;
-import android.database.Cursor;
-import android.net.Uri;
-import android.accounts.Account;
-
-/**
- * The SubscribedFeeds provider stores all information about subscribed feeds.
- * 
- * @hide
- */
-public class SubscribedFeeds {
-    private SubscribedFeeds() {}
-    
-    /**
-     * Columns from the Feed table that other tables join into themselves.
-     */
-    public interface FeedColumns {
-        /**
-         * The feed url.
-         * <P>Type: TEXT</P>
-         */
-        public static final String FEED = "feed";
-
-        /**
-         * The authority that cares about the feed.
-         * <P>Type: TEXT</P>
-         */
-        public static final String AUTHORITY = "authority";
-
-        /**
-         * The gaia service this feed is for (used for authentication).
-         * <P>Type: TEXT</P>
-         */
-        public static final String SERVICE = "service";
-    }
-
-    /**
-     * Provides constants to access the Feeds table and some utility methods
-     * to ease using the Feeds content provider.
-     */
-    public static final class Feeds implements BaseColumns, SyncConstValue,
-            FeedColumns {
-        private Feeds() {}
-        
-        public static Cursor query(ContentResolver cr, String[] projection) {
-            return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER);
-        }
-
-        public static Cursor query(ContentResolver cr, String[] projection,
-                String where, String[] whereArgs, String orderBy) {
-            return cr.query(CONTENT_URI, projection, where,
-                    whereArgs, (orderBy == null) ? DEFAULT_SORT_ORDER : orderBy);
-        }
-
-        /**
-         * The content:// style URL for this table
-         */
-        public static final Uri CONTENT_URI =
-            Uri.parse("content://subscribedfeeds/feeds");
-
-        /**
-         * The content:// style URL for this table
-         */
-        public static final Uri DELETED_CONTENT_URI =
-            Uri.parse("content://subscribedfeeds/deleted_feeds");
-
-        /**
-         * The MIME type of {@link #CONTENT_URI} providing a directory of
-         * subscribed feeds.
-         */
-        public static final String CONTENT_TYPE =
-                "vnd.android.cursor.dir/subscribedfeeds";
-
-        /**
-         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
-         * subscribed feed.
-         */
-        public static final String CONTENT_ITEM_TYPE =
-                "vnd.android.cursor.item/subscribedfeed";
-
-        /**
-         * The default sort order for this table
-         */
-        public static final String DEFAULT_SORT_ORDER = "_SYNC_ACCOUNT_TYPE, _SYNC_ACCOUNT ASC";
-    }
-
-    /**
-     * A convenience method to add a feed to the SubscribedFeeds
-     * content provider. The user specifies the values of the FEED,
-     * _SYNC_ACCOUNT, AUTHORITY. SERVICE, and ROUTING_INFO.
-     * @param resolver          used to access the underlying content provider
-     * @param feed              corresponds to the FEED column
-     * @param account           corresponds to the _SYNC_ACCOUNT column
-     * @param authority         corresponds to the AUTHORITY column
-     * @param service           corresponds to the SERVICE column
-     * @return  the Uri of the feed that was added
-     */
-    public static Uri addFeed(ContentResolver resolver,
-            String feed, Account account,
-            String authority, String service) {
-        ContentValues values = new ContentValues();
-        values.put(SubscribedFeeds.Feeds.FEED, feed);
-        values.put(SubscribedFeeds.Feeds._SYNC_ACCOUNT, account.name);
-        values.put(SubscribedFeeds.Feeds._SYNC_ACCOUNT_TYPE, account.type);
-        values.put(SubscribedFeeds.Feeds.AUTHORITY, authority);
-        values.put(SubscribedFeeds.Feeds.SERVICE, service);
-        return resolver.insert(SubscribedFeeds.Feeds.CONTENT_URI, values);
-    }
-
-    public static int deleteFeed(ContentResolver resolver,
-            String feed, Account account, String authority) {
-        StringBuilder where = new StringBuilder();
-        where.append(SubscribedFeeds.Feeds._SYNC_ACCOUNT + "=?");
-        where.append(" AND " + SubscribedFeeds.Feeds._SYNC_ACCOUNT_TYPE + "=?");
-        where.append(" AND " + SubscribedFeeds.Feeds.FEED + "=?");
-        where.append(" AND " + SubscribedFeeds.Feeds.AUTHORITY + "=?");
-        return resolver.delete(SubscribedFeeds.Feeds.CONTENT_URI,
-                where.toString(), new String[] {account.name, account.type, feed, authority});
-    }
-
-    public static int deleteFeeds(ContentResolver resolver,
-            Account account, String authority) {
-        StringBuilder where = new StringBuilder();
-        where.append(SubscribedFeeds.Feeds._SYNC_ACCOUNT + "=?");
-        where.append(" AND " + SubscribedFeeds.Feeds._SYNC_ACCOUNT_TYPE + "=?");
-        where.append(" AND " + SubscribedFeeds.Feeds.AUTHORITY + "=?");
-        return resolver.delete(SubscribedFeeds.Feeds.CONTENT_URI,
-                where.toString(), new String[] {account.name, account.type, authority});
-    }
-
-    /**
-     * Columns from the Accounts table.
-     */
-    public interface AccountColumns {
-        /**
-         * The account.
-         * <P>Type: TEXT</P>
-         */
-        public static final String _SYNC_ACCOUNT = SyncConstValue._SYNC_ACCOUNT;
-
-        /**
-         * The account type.
-         * <P>Type: TEXT</P>
-         */
-        public static final String _SYNC_ACCOUNT_TYPE = SyncConstValue._SYNC_ACCOUNT_TYPE;
-    }
-
-    /**
-     * Provides constants to access the Accounts table and some utility methods
-     * to ease using it.
-     */
-    public static final class Accounts implements BaseColumns, AccountColumns {
-        private Accounts() {}
-
-        public static Cursor query(ContentResolver cr, String[] projection) {
-            return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER);
-        }
-
-        public static Cursor query(ContentResolver cr, String[] projection,
-                String where, String orderBy) {
-            return cr.query(CONTENT_URI, projection, where,
-                    null, (orderBy == null) ? DEFAULT_SORT_ORDER : orderBy);
-        }
-
-        /**
-         * The content:// style URL for this table
-         */
-        public static final Uri CONTENT_URI =
-            Uri.parse("content://subscribedfeeds/accounts");
-
-        /**
-         * The MIME type of {@link #CONTENT_URI} providing a directory of
-         * accounts that have subscribed feeds.
-         */
-        public static final String CONTENT_TYPE =
-                "vnd.android.cursor.dir/subscribedfeedaccounts";
-
-        /**
-         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
-         * account in the subscribed feeds.
-         */
-        public static final String CONTENT_ITEM_TYPE =
-                "vnd.android.cursor.item/subscribedfeedaccount";
-
-        /**
-         * The default sort order for this table
-         */
-        public static final String DEFAULT_SORT_ORDER = "_SYNC_ACCOUNT_TYPE, _SYNC_ACCOUNT ASC";
-    }
-}
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/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index 9d17064..7969710 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -635,6 +635,15 @@
                 return err;
             }
 
+            size_t max_size;
+            CHECK_EQ(mLastTrack->sampleTable->getMaxSampleSize(&max_size), OK);
+
+            // Assume that a given buffer only contains at most 10 fragments,
+            // each fragment originally prefixed with a 2 byte length will
+            // have a 4 byte header (0x00 0x00 0x00 0x01) after conversion,
+            // and thus will grow by 2 bytes per fragment.
+            mLastTrack->meta->setInt32(kKeyMaxInputSize, max_size + 10 * 2);
+
             *offset += chunk_size;
             break;
         }
@@ -792,15 +801,10 @@
 
     mGroup = new MediaBufferGroup;
 
-    size_t max_size;
-    status_t err = mSampleTable->getMaxSampleSize(&max_size);
-    CHECK_EQ(err, OK);
+    int32_t max_size;
+    CHECK(mFormat->findInt32(kKeyMaxInputSize, &max_size));
 
-    // Assume that a given buffer only contains at most 10 fragments,
-    // each fragment originally prefixed with a 2 byte length will
-    // have a 4 byte header (0x00 0x00 0x00 0x01) after conversion,
-    // and thus will grow by 2 bytes per fragment.
-    mGroup->add_buffer(new MediaBuffer(max_size + 10 * 2));
+    mGroup->add_buffer(new MediaBuffer(max_size));
 
     mSrcBuffer = new uint8_t[max_size];
 
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 9297aff0..10a4986 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -462,7 +462,7 @@
     }
 
     int32_t maxInputSize;
-    if (createEncoder && meta->findInt32(kKeyMaxInputSize, &maxInputSize)) {
+    if (meta->findInt32(kKeyMaxInputSize, &maxInputSize)) {
         codec->setMinBufferSize(kPortIndexInput, (OMX_U32)maxInputSize);
     }
 
@@ -487,12 +487,18 @@
 
     if (def.nBufferSize < size) {
         def.nBufferSize = size;
-
     }
 
     err = mOMX->setParameter(
             mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));
     CHECK_EQ(err, OK);
+
+    err = mOMX->getParameter(
+            mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));
+    CHECK_EQ(err, OK);
+
+    // Make sure the setting actually stuck.
+    CHECK(def.nBufferSize >= size);
 }
 
 status_t OMXCodec::setVideoPortFormatType(
diff --git a/preloaded-classes b/preloaded-classes
index 67a4f65..ab83b67 100644
--- a/preloaded-classes
+++ b/preloaded-classes
@@ -630,8 +630,6 @@
 android.provider.Settings$SettingNotFoundException
 android.provider.Settings$System
 android.provider.SocialContract
-android.provider.SocialContract$Activities
-android.provider.SubscribedFeeds$Feeds
 android.provider.Telephony$BaseMmsColumns
 android.provider.Telephony$Mms
 android.provider.Telephony$Mms$Draft
diff --git a/services/java/com/android/server/HeadsetObserver.java b/services/java/com/android/server/HeadsetObserver.java
index 38ccde0..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";