Merge change 22544 into eclair

* changes:
  Fix bug that would leave old windows around.
diff --git a/api/current.xml b/api/current.xml
index bb70f6f..2d7ee31 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -14932,7 +14932,7 @@
  synchronized="false"
  static="false"
  final="false"
- deprecated="deprecated"
+ deprecated="not deprecated"
  visibility="public"
 >
 <parameter name="response" type="android.accounts.IAccountAuthenticatorResponse">
@@ -115562,7 +115562,7 @@
  synchronized="false"
  static="false"
  final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 <parameter name="asu" type="int">
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 9f70534..d04abe5 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -261,6 +261,7 @@
     }
 
     /** @deprecated use {@link #confirmCredentials} instead */
+    @Deprecated
     public AccountManagerFuture<Boolean> confirmPassword(final Account account, final String password,
             AccountManagerCallback<Boolean> callback, Handler handler) {
         return new Future2Task<Boolean>(handler, callback) {
diff --git a/core/java/android/accounts/AccountManagerFuture.java b/core/java/android/accounts/AccountManagerFuture.java
index 9939398..74d83eb 100644
--- a/core/java/android/accounts/AccountManagerFuture.java
+++ b/core/java/android/accounts/AccountManagerFuture.java
@@ -56,9 +56,11 @@
     V getResult(long timeout, TimeUnit unit)
             throws OperationCanceledException, IOException, AuthenticatorException;
 
+    /** @deprecated Use {@link #getResult} */
     @Deprecated
     V get() throws InterruptedException, ExecutionException;
 
+    /** @deprecated Use {@link #getResult}  */
     @Deprecated
     V get(long timeout, TimeUnit unit)
             throws InterruptedException, ExecutionException, TimeoutException;
diff --git a/core/java/android/accounts/IAccountAuthenticator.aidl b/core/java/android/accounts/IAccountAuthenticator.aidl
index 48f053c..1592eea 100644
--- a/core/java/android/accounts/IAccountAuthenticator.aidl
+++ b/core/java/android/accounts/IAccountAuthenticator.aidl
@@ -32,7 +32,7 @@
 
     /**
      * Checks that the account/password combination is valid.
-     * @deprecated
+     * note -- deprecated
      */
     void confirmPassword(in IAccountAuthenticatorResponse response,
         in Account account, String password);
diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java
index 4854952..e43834a 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -1769,6 +1769,7 @@
     /**
      * @deprecated This method is an obsolete internal implementation detail. Do not use.
      */
+    @Deprecated
     public void onCancel(DialogInterface dialog) {
         throw new UnsupportedOperationException();
     }
@@ -1776,6 +1777,7 @@
     /**
      * @deprecated This method is an obsolete internal implementation detail. Do not use.
      */
+    @Deprecated
     public void onDismiss(DialogInterface dialog) {
         throw new UnsupportedOperationException();
     }
diff --git a/core/java/android/bluetooth/BluetoothUuid.java b/core/java/android/bluetooth/BluetoothUuid.java
index 1ec7fb38..c15bc20 100644
--- a/core/java/android/bluetooth/BluetoothUuid.java
+++ b/core/java/android/bluetooth/BluetoothUuid.java
@@ -37,6 +37,7 @@
     public static final UUID Handsfree  = UUID.fromString("0000111E-0000-1000-8000-00805F9B34FB");
     public static final UUID AvrcpController =
                                           UUID.fromString("0000110E-0000-1000-8000-00805F9B34FB");
+    public static final UUID AvrcpTarget = UUID.fromString("0000110C-0000-1000-8000-00805F9B34FB");
 
     public static boolean isAudioSource(UUID uuid) {
         return uuid.equals(AudioSource);
@@ -61,4 +62,8 @@
     public static boolean isAvrcpController(UUID uuid) {
         return uuid.equals(AvrcpController);
     }
+
+    public static boolean isAvrcpTarget(UUID uuid) {
+        return uuid.equals(AvrcpTarget);
+    }
 }
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index b915803..88a4d02f 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -887,6 +887,7 @@
      * @deprecated instead use
      * {@link #requestSync(android.accounts.Account, String, android.os.Bundle)}
      */
+    @Deprecated
     public void startSync(Uri uri, Bundle extras) {
         Account account = null;
         if (extras != null) {
@@ -967,6 +968,7 @@
      * @param uri the uri of the provider to sync or null to sync all providers.
      * @deprecated instead use {@link #cancelSync(android.accounts.Account, String)}
      */
+    @Deprecated
     public void cancelSync(Uri uri) {
         cancelSync(null /* all accounts */, uri != null ? uri.getAuthority() : null);
     }
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index d86ab79..60551b8 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -491,42 +491,49 @@
      * @deprecated Use {@link android.app.WallpaperManager#getDrawable
      * WallpaperManager.get()} instead.
      */
+    @Deprecated
     public abstract Drawable getWallpaper();
 
     /**
      * @deprecated Use {@link android.app.WallpaperManager#peekDrawable
      * WallpaperManager.peek()} instead.
      */
+    @Deprecated
     public abstract Drawable peekWallpaper();
 
     /**
      * @deprecated Use {@link android.app.WallpaperManager#getDesiredMinimumWidth()
      * WallpaperManager.getDesiredMinimumWidth()} instead.
      */
+    @Deprecated
     public abstract int getWallpaperDesiredMinimumWidth();
 
     /**
      * @deprecated Use {@link android.app.WallpaperManager#getDesiredMinimumHeight()
      * WallpaperManager.getDesiredMinimumHeight()} instead.
      */
+    @Deprecated
     public abstract int getWallpaperDesiredMinimumHeight();
 
     /**
      * @deprecated Use {@link android.app.WallpaperManager#setBitmap(Bitmap)
      * WallpaperManager.set()} instead.
      */
+    @Deprecated
     public abstract void setWallpaper(Bitmap bitmap) throws IOException;
 
     /**
      * @deprecated Use {@link android.app.WallpaperManager#setStream(InputStream)
      * WallpaperManager.set()} instead.
      */
+    @Deprecated
     public abstract void setWallpaper(InputStream data) throws IOException;
 
     /**
      * @deprecated Use {@link android.app.WallpaperManager#clear
      * WallpaperManager.clear()} instead.
      */
+    @Deprecated
     public abstract void clearWallpaper() throws IOException;
 
     /**
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 7760612..4fc4fb9 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -123,7 +123,6 @@
      *                 providers that can sync.
      * @param outInfo Filled in with a list of the ProviderInfo for each
      *                name in 'outNames'.
-     * @deprecated
      */
     void querySyncProviders(inout List<String> outNames,
             inout List<ProviderInfo> outInfo);
diff --git a/core/java/android/content/pm/ProviderInfo.java b/core/java/android/content/pm/ProviderInfo.java
index d61e95b..ec01775 100644
--- a/core/java/android/content/pm/ProviderInfo.java
+++ b/core/java/android/content/pm/ProviderInfo.java
@@ -79,6 +79,7 @@
      * @deprecated This flag is now being ignored. The current way to make a provider
      * syncable is to provide a SyncAdapter service for a given provider/account type. 
      */
+    @Deprecated
     public boolean isSyncable = false;
 
     public ProviderInfo() {
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 184d6dc..6143b6c 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -517,6 +517,7 @@
      * @deprecated if the db is locked more than once (becuase of nested transactions) then the lock
      *   will not be yielded. Use yieldIfContendedSafely instead.
      */
+    @Deprecated
     public boolean yieldIfContended() {
         return yieldIfContendedHelper(false /* do not check yielding */);
     }
diff --git a/core/java/android/hardware/SensorListener.java b/core/java/android/hardware/SensorListener.java
index cfa184b..c71e968 100644
--- a/core/java/android/hardware/SensorListener.java
+++ b/core/java/android/hardware/SensorListener.java
@@ -20,9 +20,8 @@
  * Used for receiving notifications from the SensorManager when
  * sensor values have changed.
  * 
- * This interface is deprecated, use 
+ * @deprecated Use 
  * {@link android.hardware.SensorEventListener SensorEventListener} instead.
- * 
  */
 @Deprecated
 public interface SensorListener {
diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java
index bf945ec..271f973 100644
--- a/core/java/android/hardware/SensorManager.java
+++ b/core/java/android/hardware/SensorManager.java
@@ -116,47 +116,67 @@
     @Deprecated
     public static final int SENSOR_ORIENTATION_RAW = 1 << 7;
 
-    /** A constant that includes all sensors */
+    /** A constant that includes all sensors
+     * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+     */
     @Deprecated
     public static final int SENSOR_ALL = 0x7F;
 
-    /** Smallest sensor ID */
+    /** Smallest sensor ID 
+     * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+     */
     @Deprecated
     public static final int SENSOR_MIN = SENSOR_ORIENTATION;
 
-    /** Largest sensor ID */
+    /** Largest sensor ID
+     * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+     */
     @Deprecated
     public static final int SENSOR_MAX = ((SENSOR_ALL + 1)>>1);
 
 
     /** Index of the X value in the array returned by
-     * {@link android.hardware.SensorListener#onSensorChanged} */
+     * {@link android.hardware.SensorListener#onSensorChanged}
+     * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+     */
     @Deprecated
     public static final int DATA_X = 0;
     /** Index of the Y value in the array returned by
-     * {@link android.hardware.SensorListener#onSensorChanged} */
+     * {@link android.hardware.SensorListener#onSensorChanged}
+     * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+     */
     @Deprecated
     public static final int DATA_Y = 1;
     /** Index of the Z value in the array returned by
-     * {@link android.hardware.SensorListener#onSensorChanged} */
+     * {@link android.hardware.SensorListener#onSensorChanged}
+     * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+     */
     @Deprecated
     public static final int DATA_Z = 2;
 
     /** Offset to the untransformed values in the array returned by
-     * {@link android.hardware.SensorListener#onSensorChanged} */
+     * {@link android.hardware.SensorListener#onSensorChanged}
+     * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+     */
     @Deprecated
     public static final int RAW_DATA_INDEX = 3;
 
     /** Index of the untransformed X value in the array returned by
-     * {@link android.hardware.SensorListener#onSensorChanged} */
+     * {@link android.hardware.SensorListener#onSensorChanged}
+     * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+     */
     @Deprecated
     public static final int RAW_DATA_X = 3;
     /** Index of the untransformed Y value in the array returned by
-     * {@link android.hardware.SensorListener#onSensorChanged} */
+     * {@link android.hardware.SensorListener#onSensorChanged}
+     * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+     */
     @Deprecated
     public static final int RAW_DATA_Y = 4;
     /** Index of the untransformed Z value in the array returned by
-     * {@link android.hardware.SensorListener#onSensorChanged} */
+     * {@link android.hardware.SensorListener#onSensorChanged}
+     * @deprecated use {@link android.hardware.Sensor Sensor} instead.
+     */
     @Deprecated
     public static final int RAW_DATA_Z = 5;
 
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index b1421d1..f88fcdc 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -147,7 +147,10 @@
                             ", unavailable = " + unavailable + ", reason = " +
                             (reason == null ? "(unspecified)" : reason));
 
+
                     if (isApnTypeIncluded(apnTypeList)) {
+                        // set this even if the apn isn't Enabled
+                        mNetworkInfo.setIsAvailable(!unavailable);
                         if (mEnabled == false) {
                             // if we're not enabled but the APN Type is supported by this connection
                             // we should record the interface name if one's provided.  If the user
@@ -168,7 +171,6 @@
                         return;
                     }
 
-                    mNetworkInfo.setIsAvailable(!unavailable);
                     if (mMobileDataState != state) {
                         mMobileDataState = state;
                         switch (state) {
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index ffd2686..6c2a27a 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -70,6 +70,7 @@
          * 
          * @deprecated Use {@link #SDK_INT} to easily get this as an integer.
          */
+        @Deprecated
         public static final String SDK = getString("ro.build.version.sdk");
 
         /**
diff --git a/core/java/android/os/HandlerStateMachine.java b/core/java/android/os/HandlerStateMachine.java
index d004a25..9e7902b 100644
--- a/core/java/android/os/HandlerStateMachine.java
+++ b/core/java/android/os/HandlerStateMachine.java
@@ -56,22 +56,22 @@
         }
 
         class S1 extends HandlerState {
-            @Override public void enter(Message message) {
+            &amp;#064;Override public void enter(Message message) {
             }
 
-            @Override public void processMessage(Message message) {
+            &amp;#064;Override public void processMessage(Message message) {
                 deferMessage(message);
                 if (message.what == TEST_WHAT_2) {
                     transitionTo(mS2);
                 }
             }
 
-            @Override public void exit(Message message) {
+            &amp;#064;Override public void exit(Message message) {
             }
         }
 
         class S2 extends HandlerState {
-            @Override public void processMessage(Message message) {
+            &amp;#064;Override public void processMessage(Message message) {
                 // Do some processing
                 if (message.what == TEST_WHAT_2) {
                     transtionTo(mS1);
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 3a4449e..255534d 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -343,7 +343,7 @@
             Cursor cursor = cr.query(photoUri,
                     new String[]{ContactsContract.CommonDataKinds.Photo.PHOTO}, null, null, null);
             try {
-                if (!cursor.moveToNext()) {
+                if (cursor == null || !cursor.moveToNext()) {
                     return null;
                 }
                 byte[] data = cursor.getBlob(0);
@@ -352,7 +352,9 @@
                 }
                 return new ByteArrayInputStream(data);
             } finally {
-                cursor.close();
+                if (cursor != null) {
+                    cursor.close();
+                }
             }
         }
     }
diff --git a/core/java/android/provider/Gmail.java b/core/java/android/provider/Gmail.java
index 5702e7c..4425e51 100644
--- a/core/java/android/provider/Gmail.java
+++ b/core/java/android/provider/Gmail.java
@@ -1521,8 +1521,9 @@
 
         /**
          * Returns the number of conversation with a given label.
-         * @deprecated
+         * @deprecated Use {@link #getLabelId} instead.
          */
+        @Deprecated
         public int getNumConversations(String label) {
             return getNumConversations(getLabelId(label));
         }
@@ -1534,8 +1535,9 @@
 
         /**
          * Returns the number of unread conversation with a given label.
-         * @deprecated
+         * @deprecated Use {@link #getLabelId} instead.
          */
+        @Deprecated
         public int getNumUnreadConversations(String label) {
             return getNumUnreadConversations(getLabelId(label));
         }
@@ -2040,8 +2042,9 @@
         }
 
         /**
-         * @deprecated
+         * @deprecated Always returns true.
          */
+        @Deprecated
         public boolean getExpanded() {
             return true;
         }
diff --git a/core/java/android/provider/LiveFolders.java b/core/java/android/provider/LiveFolders.java
index 6e95fb7..19f361b 100644
--- a/core/java/android/provider/LiveFolders.java
+++ b/core/java/android/provider/LiveFolders.java
@@ -45,7 +45,7 @@
  * public static class MyLiveFolder extends Activity {
  *     public static final Uri CONTENT_URI = Uri.parse("content://my.app/live");
  *
- *     @Override
+ *     &amp;#064;Override
  *     protected void onCreate(Bundle savedInstanceState) {
  *         super.onCreate(savedInstanceState);
  *
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index decf6fc..ee46c85 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -1522,18 +1522,17 @@
         @Deprecated
         public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL;
 
-//       /**
-//         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT}
-//         * instead
-//         */
+       /**
+         * @deprecated Use
+         * {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} instead
+         */
         @Deprecated
         public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT;
 
-//        /**
-//         * @deprecated Use
-//         * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS}
-//         * instead
-//         */
+        /**
+         * @deprecated Use
+         * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
+         */
         @Deprecated
         public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
                 Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java
index 6610d0e..34d6d03 100644
--- a/core/java/android/server/BluetoothEventLoop.java
+++ b/core/java/android/server/BluetoothEventLoop.java
@@ -431,7 +431,7 @@
         boolean authorized = false;
         UUID uuid = UUID.fromString(deviceUuid);
         if (mBluetoothService.isEnabled() &&
-                (BluetoothUuid.isAudioSink(uuid) || BluetoothUuid.isAvrcpController(uuid)
+                (BluetoothUuid.isAudioSink(uuid) || BluetoothUuid.isAvrcpTarget(uuid)
                         || BluetoothUuid.isAdvAudioDist(uuid))) {
             BluetoothA2dp a2dp = new BluetoothA2dp(mContext);
             BluetoothDevice device = mAdapter.getRemoteDevice(address);
diff --git a/core/java/android/text/style/ImageSpan.java b/core/java/android/text/style/ImageSpan.java
index 86ef5f6..74b9463 100644
--- a/core/java/android/text/style/ImageSpan.java
+++ b/core/java/android/text/style/ImageSpan.java
@@ -36,6 +36,7 @@
     /**
      * @deprecated Use {@link #ImageSpan(Context, Bitmap)} instead.
      */
+    @Deprecated
     public ImageSpan(Bitmap b) {
         this(null, b, ALIGN_BOTTOM);
     }
@@ -43,6 +44,7 @@
     /**
      * @deprecated Use {@link #ImageSpan(Context, Bitmap, int) instead.
      */
+    @Deprecated
     public ImageSpan(Bitmap b, int verticalAlignment) {
         this(null, b, verticalAlignment);
     }
diff --git a/core/java/android/util/Config.java b/core/java/android/util/Config.java
index 9571041..924b49d 100644
--- a/core/java/android/util/Config.java
+++ b/core/java/android/util/Config.java
@@ -34,25 +34,25 @@
      */
 
     /**
-     * Always the inverse of DEBUG.
+     * @deprecated Use {@link #DEBUG} instead.
      */
     @Deprecated
     public static final boolean RELEASE = !DEBUG;
 
     /**
-     * Always false.
+     * @deprecated Always false.
      */
     @Deprecated
     public static final boolean PROFILE = false;
 
     /**
-     * Always false.
+     * @deprecated Always false.
      */
     @Deprecated
     public static final boolean LOGV = false;
 
     /**
-     * Always true.
+     * @deprecated Always true.
      */
     @Deprecated
     public static final boolean LOGD = true;
diff --git a/core/java/android/view/animation/Animation.java b/core/java/android/view/animation/Animation.java
index a662760..2f5e601 100644
--- a/core/java/android/view/animation/Animation.java
+++ b/core/java/android/view/animation/Animation.java
@@ -319,7 +319,7 @@
      * 
      * @param durationMillis Duration in milliseconds
      *
-     * @throw java.lang.IllegalArgumentException if the duration is < 0
+     * @throws java.lang.IllegalArgumentException if the duration is < 0
      *
      * @attr ref android.R.styleable#Animation_duration
      */
diff --git a/core/java/android/webkit/Plugin.java b/core/java/android/webkit/Plugin.java
index 302bea2..34a30a9 100644
--- a/core/java/android/webkit/Plugin.java
+++ b/core/java/android/webkit/Plugin.java
@@ -27,7 +27,7 @@
  * Represents a plugin (Java equivalent of the PluginPackageAndroid
  * C++ class in libs/WebKitLib/WebKit/WebCore/plugins/android/)
  *
- * @deprecated This interface was inteded to be used by Gears. Since Gears was
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
  * deprecated, so is this class.
  */
 @Deprecated
@@ -43,7 +43,8 @@
     private PreferencesClickHandler mHandler;
 
     /**
-     * @deprecated
+     * @deprecated This interface was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public Plugin(String name,
@@ -58,7 +59,8 @@
     }
 
     /**
-     * @deprecated
+     * @deprecated This interface was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public String toString() {
@@ -66,7 +68,8 @@
     }
 
     /**
-     * @deprecated
+     * @deprecated This interface was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public String getName() {
@@ -74,7 +77,8 @@
     }
 
     /**
-     * @deprecated
+     * @deprecated This interface was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public String getPath() {
@@ -82,7 +86,8 @@
     }
 
     /**
-     * @deprecated
+     * @deprecated This interface was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public String getFileName() {
@@ -90,7 +95,8 @@
     }
 
     /**
-     * @deprecated
+     * @deprecated This interface was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public String getDescription() {
@@ -98,7 +104,8 @@
     }
 
     /**
-     * @deprecated
+     * @deprecated This interface was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public void setName(String name) {
@@ -106,7 +113,8 @@
     }
 
     /**
-     * @deprecated
+     * @deprecated This interface was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public void setPath(String path) {
@@ -114,7 +122,8 @@
     }
 
     /**
-     * @deprecated
+     * @deprecated This interface was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public void setFileName(String fileName) {
@@ -122,7 +131,8 @@
     }
 
     /**
-     * @deprecated
+     * @deprecated This interface was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public void setDescription(String description) {
@@ -130,7 +140,8 @@
     }
 
     /**
-     * @deprecated
+     * @deprecated This interface was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public void setClickHandler(PreferencesClickHandler handler) {
@@ -140,7 +151,8 @@
    /**
     * Invokes the click handler for this plugin.
     *
-    * @deprecated
+    * @deprecated This interface was intended to be used by Gears. Since Gears was
+    * deprecated, so is this class.
     */
     @Deprecated
     public void dispatchClickEvent(Context context) {
@@ -152,7 +164,8 @@
    /**
     * Default click handler. The plugins should implement their own.
     *
-    * @deprecated
+    * @deprecated This interface was intended to be used by Gears. Since Gears was
+    * deprecated, so is this class.
     */
     @Deprecated
     private class DefaultClickHandler implements PreferencesClickHandler,
@@ -172,7 +185,8 @@
             }
         }
         /**
-         * @deprecated
+         * @deprecated This interface was intended to be used by Gears. Since Gears was
+         * deprecated, so is this class.
          */
         @Deprecated
         public void onClick(DialogInterface dialog, int which) {
diff --git a/core/java/android/webkit/PluginData.java b/core/java/android/webkit/PluginData.java
index d9b196a..2dd445e 100644
--- a/core/java/android/webkit/PluginData.java
+++ b/core/java/android/webkit/PluginData.java
@@ -28,7 +28,7 @@
  * status code. The PluginData class is the container for all these
  * parts.
  *
- * @deprecated This class was inteded to be used by Gears. Since Gears was
+ * @deprecated This class was intended to be used by Gears. Since Gears was
  * deprecated, so is this class.
  */
 @Deprecated
@@ -63,7 +63,8 @@
      * lowercase header name to [ unmodified header name, header value]
      * @param length The HTTP response status code.
      *
-     * @deprecated
+     * @deprecated This class was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public PluginData(
@@ -82,7 +83,8 @@
      *
      * @return An InputStream instance with the plugin content.
      *
-     * @deprecated
+     * @deprecated This class was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public InputStream getInputStream() {
@@ -94,7 +96,8 @@
      *
      * @return the length of the plugin content.
      *
-     * @deprecated
+     * @deprecated This class was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public long getContentLength() {
@@ -109,7 +112,8 @@
      * mapping is 'lowercase header name' to ['unmodified header
      * name', header value].
      *
-     * @deprecated
+     * @deprecated This class was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public Map<String, String[]> getHeaders() {
@@ -121,7 +125,8 @@
      *
      * @return The HTTP statue code, e.g 200.
      *
-     * @deprecated
+     * @deprecated This class was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public int getStatusCode() {
diff --git a/core/java/android/webkit/PluginList.java b/core/java/android/webkit/PluginList.java
index 5b65b9a..a61b07b 100644
--- a/core/java/android/webkit/PluginList.java
+++ b/core/java/android/webkit/PluginList.java
@@ -25,7 +25,7 @@
  * populated when the plugins are initialized (at
  * browser startup, at the moment).
  *
- * @deprecated This interface was inteded to be used by Gears. Since Gears was
+ * @deprecated This interface was intended to be used by Gears. Since Gears was
  * deprecated, so is this class.
  */
 @Deprecated
@@ -35,7 +35,8 @@
    /**
     * Public constructor. Initializes the list of plugins.
     *
-    * @deprecated
+    * @deprecated This interface was intended to be used by Gears. Since Gears was
+    * deprecated, so is this class.
     */
     @Deprecated
     public PluginList() {
@@ -45,7 +46,8 @@
    /**
     * Returns the list of plugins as a java.util.List.
     *
-    * @deprecated
+    * @deprecated This interface was intended to be used by Gears. Since Gears was
+    * deprecated, so is this class.
     */
     @Deprecated
     public synchronized List getList() {
@@ -55,7 +57,8 @@
    /**
     * Adds a plugin to the list.
     *
-    * @deprecated
+    * @deprecated This interface was intended to be used by Gears. Since Gears was
+    * deprecated, so is this class.
     */
     @Deprecated
     public synchronized void addPlugin(Plugin plugin) {
@@ -67,7 +70,8 @@
    /**
     * Removes a plugin from the list.
     *
-    * @deprecated
+    * @deprecated This interface was intended to be used by Gears. Since Gears was
+    * deprecated, so is this class.
     */
     @Deprecated
     public synchronized void removePlugin(Plugin plugin) {
@@ -80,7 +84,8 @@
    /**
     * Clears the plugin list.
     *
-    * @deprecated
+    * @deprecated This interface was intended to be used by Gears. Since Gears was
+    * deprecated, so is this class.
     */
     @Deprecated
     public synchronized void clear() {
@@ -90,7 +95,8 @@
    /**
     * Dispatches the click event to the appropriate plugin.
     *
-    * @deprecated
+    * @deprecated This interface was intended to be used by Gears. Since Gears was
+    * deprecated, so is this class.
     */
     @Deprecated
     public synchronized void pluginClicked(Context context, int position) {
diff --git a/core/java/android/webkit/URLUtil.java b/core/java/android/webkit/URLUtil.java
index 5ed42e9..232ed36 100644
--- a/core/java/android/webkit/URLUtil.java
+++ b/core/java/android/webkit/URLUtil.java
@@ -172,6 +172,7 @@
      * requests from a file url.
      * @deprecated Cookieless proxy is no longer supported.
      */
+    @Deprecated
     public static boolean isCookielessProxyUrl(String url) {
         return (null != url) && url.startsWith(PROXY_BASE);
     }
diff --git a/core/java/android/webkit/UrlInterceptRegistry.java b/core/java/android/webkit/UrlInterceptRegistry.java
index 6e2a482..eca5acd 100644
--- a/core/java/android/webkit/UrlInterceptRegistry.java
+++ b/core/java/android/webkit/UrlInterceptRegistry.java
@@ -25,7 +25,7 @@
 import java.util.Map;
 
 /**
- * @deprecated This class was inteded to be used by Gears. Since Gears was
+ * @deprecated This class was intended to be used by Gears. Since Gears was
  * deprecated, so is this class.
  */
 @Deprecated
@@ -48,7 +48,8 @@
      * 
      * @param disabled true to disable the cache
      *
-     * @deprecated
+     * @deprecated This class was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public static synchronized void setUrlInterceptDisabled(boolean disabled) {
@@ -60,7 +61,8 @@
      * 
      * @return return if it is disabled
      *
-     * @deprecated
+     * @deprecated This class was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public static synchronized boolean urlInterceptDisabled() {
@@ -74,7 +76,8 @@
      * @param handler The new UrlInterceptHandler object
      * @return true if the handler was not previously registered.
      *
-     * @deprecated
+     * @deprecated This class was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public static synchronized boolean registerHandler(
@@ -93,7 +96,8 @@
      * @param handler A previously registered UrlInterceptHandler.
      * @return true if the handler was found and removed from the list.
      *
-     * @deprecated
+     * @deprecated This class was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public static synchronized boolean unregisterHandler(
@@ -107,7 +111,8 @@
      *
      * @return A CacheResult containing surrogate content.
      *
-     * @deprecated
+     * @deprecated This class was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public static synchronized CacheResult getSurrogate(
@@ -133,7 +138,8 @@
      *
      * @return A PluginData instance containing surrogate content.
      *
-     * @deprecated
+     * @deprecated This class was intended to be used by Gears. Since Gears was
+     * deprecated, so is this class.
      */
     @Deprecated
     public static synchronized PluginData getPluginData(
diff --git a/graphics/java/android/graphics/drawable/BitmapDrawable.java b/graphics/java/android/graphics/drawable/BitmapDrawable.java
index eade73a..1755d4f 100644
--- a/graphics/java/android/graphics/drawable/BitmapDrawable.java
+++ b/graphics/java/android/graphics/drawable/BitmapDrawable.java
@@ -76,6 +76,7 @@
      * @deprecated Use {@link #BitmapDrawable(Resources)} to ensure
      * that the drawable has correctly set its target density.
      */
+    @Deprecated
     public BitmapDrawable() {
         mBitmapState = new BitmapState((Bitmap) null);
     }
@@ -97,6 +98,7 @@
      * @deprecated Use {@link #BitmapDrawable(Resources, Bitmap)} to ensure
      * that the drawable has correctly set its target density.
      */
+    @Deprecated
     public BitmapDrawable(Bitmap bitmap) {
         this(new BitmapState(bitmap));
     }
diff --git a/graphics/java/android/graphics/drawable/NinePatchDrawable.java b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
index d5c8a08..b175bb6 100644
--- a/graphics/java/android/graphics/drawable/NinePatchDrawable.java
+++ b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
@@ -56,6 +56,7 @@
      * @deprecated Use {@link #NinePatchDrawable(Resources, Bitmap, byte[], Rect, String)}
      * to ensure that the drawable has correctly set its target density.
      */
+    @Deprecated
     public NinePatchDrawable(Bitmap bitmap, byte[] chunk, Rect padding, String srcName) {
         this(new NinePatchState(new NinePatch(bitmap, chunk, srcName), padding));
     }
@@ -78,6 +79,7 @@
      * @deprecated Use {@link #NinePatchDrawable(Resources, NinePatch)}
      * to ensure that the drawable has correctly set its target density.
      */
+    @Deprecated
     public NinePatchDrawable(NinePatch patch) {
         this(new NinePatchState(patch, null));
     }
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 16bf8a2..de944ee 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -816,37 +816,44 @@
     /* Routing bits for setRouting/getRouting API */
     /**
      * Routing audio output to earpiece
-     * @deprecated
+     * @deprecated   Do not set audio routing directly, use setSpeakerphoneOn(),
+     * setBluetoothScoOn() methods instead.
      */
     @Deprecated public static final int ROUTE_EARPIECE          = AudioSystem.ROUTE_EARPIECE;
     /**
-     * Routing audio output to spaker
-     * @deprecated
+     * Routing audio output to speaker
+     * @deprecated   Do not set audio routing directly, use setSpeakerphoneOn(),
+     * setBluetoothScoOn() methods instead.
      */
     @Deprecated public static final int ROUTE_SPEAKER           = AudioSystem.ROUTE_SPEAKER;
     /**
      * @deprecated use {@link #ROUTE_BLUETOOTH_SCO}
-     * @deprecated
+     * @deprecated   Do not set audio routing directly, use setSpeakerphoneOn(),
+     * setBluetoothScoOn() methods instead.
      */
     @Deprecated public static final int ROUTE_BLUETOOTH = AudioSystem.ROUTE_BLUETOOTH_SCO;
     /**
      * Routing audio output to bluetooth SCO
-     * @deprecated
+     * @deprecated   Do not set audio routing directly, use setSpeakerphoneOn(),
+     * setBluetoothScoOn() methods instead.
      */
     @Deprecated public static final int ROUTE_BLUETOOTH_SCO     = AudioSystem.ROUTE_BLUETOOTH_SCO;
     /**
      * Routing audio output to headset
-     * @deprecated
+     * @deprecated   Do not set audio routing directly, use setSpeakerphoneOn(),
+     * setBluetoothScoOn() methods instead.
      */
     @Deprecated public static final int ROUTE_HEADSET           = AudioSystem.ROUTE_HEADSET;
     /**
      * Routing audio output to bluetooth A2DP
-     * @deprecated
+     * @deprecated   Do not set audio routing directly, use setSpeakerphoneOn(),
+     * setBluetoothScoOn() methods instead.
      */
     @Deprecated public static final int ROUTE_BLUETOOTH_A2DP    = AudioSystem.ROUTE_BLUETOOTH_A2DP;
     /**
      * Used for mask parameter of {@link #setRouting(int,int,int)}.
-     * @deprecated
+     * @deprecated   Do not set audio routing directly, use setSpeakerphoneOn(),
+     * setBluetoothScoOn() methods instead.
      */
     @Deprecated public static final int ROUTE_ALL               = AudioSystem.ROUTE_ALL;
 
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index d587f65..dbf6d9d 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -93,8 +93,9 @@
      *
      * return      the current audio mode (NORMAL, RINGTONE, or IN_CALL).
      *              Returns the current current audio state from the HAL.
+     *              
      */
-    /** @deprecated */
+    /** @deprecated Do not use. */
     public static int getMode() {
         return MODE_INVALID;
     }
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index a8689f2..6a9a9bd 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -539,7 +539,7 @@
      * @param request Parcel with the data for the extension. The
      * caller must use {@link #newRequest()} to get one.
      *
-     * @param[out] reply Parcel with the data returned by the
+     * @param reply Output parcel with the data returned by the
      * native player.
      *
      * @return The status code see utils/Errors.h
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 46ede7f..9bb00c6 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -168,7 +168,7 @@
 
         /** The following formats are audio only .aac or .amr formats **/
         /** @deprecated  Deprecated in favor of AMR_NB */
-        /** @todo change link when AMR_NB is exposed. Deprecated in favor of {@link MediaRecorder.OutputFormat#AMR_NB} */
+        /** TODO: change link when AMR_NB is exposed. Deprecated in favor of MediaRecorder.OutputFormat.AMR_NB */
         public static final int RAW_AMR = 3;
         /** @hide AMR NB file format */
         public static final int AMR_NB = 3;
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 03e764c..363595e 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -36,6 +36,8 @@
 #include <cutils/properties.h>
 #include <cutils/memory.h>
 
+#include <utils/SortedVector.h>
+
 #include "hooks.h"
 #include "egl_impl.h"
 #include "Loader.h"
@@ -63,23 +65,91 @@
 
 // ----------------------------------------------------------------------------
 
-template <int MAGIC>
-struct egl_object_t
-{
-    egl_object_t() : magic(MAGIC) { }
-    ~egl_object_t() { magic = 0; }
-    bool isValid() const { return magic == MAGIC; }
+class egl_object_t {
+    static SortedVector<egl_object_t*> sObjects;
+    static Mutex sLock;
+
+            volatile int32_t  terminated;
+    mutable volatile int32_t  count;
+
+public:
+    egl_object_t() : terminated(0), count(1) { 
+        Mutex::Autolock _l(sLock);
+        sObjects.add(this);
+    }
+
+    inline bool isAlive() const { return !terminated; }
+
 private:
-    uint32_t    magic;
+    bool get() {
+        Mutex::Autolock _l(sLock);
+        if (egl_object_t::sObjects.indexOf(this) >= 0) {
+            android_atomic_inc(&count);
+            return true;
+        }
+        return false;
+    }
+
+    bool put() {
+        Mutex::Autolock _l(sLock);
+        if (android_atomic_dec(&count) == 1) {
+            sObjects.remove(this);
+            return true;
+        }
+        return false;
+    }    
+
+public:
+    template <typename N, typename T>
+    struct LocalRef {
+        N* ref;
+        LocalRef(T o) : ref(0) {
+            N* native = reinterpret_cast<N*>(o);
+            if (o && native->get()) {
+                ref = native;
+            }
+        }
+        ~LocalRef() { 
+            if (ref && ref->put()) {
+                delete ref;
+            }
+        }
+        inline N* get() {
+            return ref;
+        }
+        void acquire() const {
+            if (ref) {
+                android_atomic_inc(&ref->count);
+            }
+        }
+        void release() const {
+            if (ref) {
+                int32_t c = android_atomic_dec(&ref->count);
+                // ref->count cannot be 1 prior atomic_dec because we have
+                // a reference, and if we have one, it means there was
+                // already one before us.
+                LOGE_IF(c==1, "refcount is now 0 in release()");
+            }
+        }
+        void terminate() {
+            if (ref) {
+                ref->terminated = 1;
+                release();
+            }
+        }
+    };
 };
 
-struct egl_display_t : public egl_object_t<'_dpy'>
+SortedVector<egl_object_t*> egl_object_t::sObjects;
+Mutex egl_object_t::sLock;
+
+struct egl_display_t
 {
+    uint32_t    magic;
     EGLDisplay  dpys[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
     EGLConfig*  configs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
     EGLint      numConfigs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
     EGLint      numTotalConfigs;
-    char const* extensionsString;
     volatile int32_t refs;
     struct strings_t {
         char const * vendor;
@@ -88,15 +158,19 @@
         char const * extensions;
     };
     strings_t   queryString[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
+    egl_display_t() : magic('_dpy') { }
+    ~egl_display_t() { magic = 0; }
+    inline bool isValid() const { return magic == '_dpy'; }
+    inline bool isAlive() const { return isValid(); }
 };
 
-struct egl_surface_t : public egl_object_t<'_srf'>
+struct egl_surface_t : public egl_object_t
 {
+    typedef egl_object_t::LocalRef<egl_surface_t, EGLSurface> Ref;
+
     egl_surface_t(EGLDisplay dpy, EGLSurface surface,
             int impl, egl_connection_t const* cnx) 
-    : dpy(dpy), surface(surface), impl(impl), cnx(cnx)
-    {
-        // NOTE: window must be incRef'ed and connected already
+    : dpy(dpy), surface(surface), impl(impl), cnx(cnx) {
     }
     ~egl_surface_t() {
     }
@@ -106,8 +180,10 @@
     egl_connection_t const*     cnx;
 };
 
-struct egl_context_t : public egl_object_t<'_ctx'>
+struct egl_context_t : public egl_object_t
 {
+    typedef egl_object_t::LocalRef<egl_context_t, EGLContext> Ref;
+    
     egl_context_t(EGLDisplay dpy, EGLContext context,
             int impl, egl_connection_t const* cnx) 
     : dpy(dpy), context(context), read(0), draw(0), impl(impl), cnx(cnx)
@@ -121,8 +197,10 @@
     egl_connection_t const*     cnx;
 };
 
-struct egl_image_t : public egl_object_t<'_img'>
+struct egl_image_t : public egl_object_t
 {
+    typedef egl_object_t::LocalRef<egl_image_t, EGLImageKHR> Ref;
+
     egl_image_t(EGLDisplay dpy, EGLContext context)
         : dpy(dpy), context(context)
     {
@@ -133,6 +211,10 @@
     EGLImageKHR images[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
 };
 
+typedef egl_surface_t::Ref  SurfaceRef;
+typedef egl_context_t::Ref  ContextRef;
+typedef egl_image_t::Ref    ImageRef;
+
 struct tls_t
 {
     tls_t() : error(EGL_SUCCESS), ctx(0), logCallWithNoContext(EGL_TRUE) { }
@@ -405,11 +487,9 @@
 {
     if ((uintptr_t(dpy)-1U) >= NUM_DISPLAYS)
         return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-    if (!get_display(dpy)->isValid())
+    if (!get_display(dpy)->isAlive())
         return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-    if (!ctx) // TODO: make sure context is a valid object
-        return setError(EGL_BAD_CONTEXT, EGL_FALSE);
-    if (!get_context(ctx)->isValid())
+    if (!get_context(ctx)->isAlive())
         return setError(EGL_BAD_CONTEXT, EGL_FALSE);
     return EGL_TRUE;
 }
@@ -418,30 +498,27 @@
 {
     if ((uintptr_t(dpy)-1U) >= NUM_DISPLAYS)
         return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-    if (!get_display(dpy)->isValid())
+    if (!get_display(dpy)->isAlive())
         return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-    if (!surface) // TODO: make sure surface is a valid object
-        return setError(EGL_BAD_SURFACE, EGL_FALSE);
-    if (!get_surface(surface)->isValid())
+    if (!get_surface(surface)->isAlive())
         return setError(EGL_BAD_SURFACE, EGL_FALSE);
     return EGL_TRUE;
 }
 
-
 EGLImageKHR egl_get_image_for_current_context(EGLImageKHR image)
 {
+    ImageRef _i(image);
+    if (!_i.get()) return EGL_NO_IMAGE_KHR;
+    
     EGLContext context = getContext();
     if (context == EGL_NO_CONTEXT || image == EGL_NO_IMAGE_KHR)
         return EGL_NO_IMAGE_KHR;
     
     egl_context_t const * const c = get_context(context);
-    if (!c->isValid())
+    if (!c->isAlive())
         return EGL_NO_IMAGE_KHR;
 
     egl_image_t const * const i = get_image(image);
-    if (!i->isValid())
-        return EGL_NO_IMAGE_KHR;
-
     return i->images[c->impl];
 }
 
@@ -563,7 +640,6 @@
     // initialize each EGL and
     // build our own extension string first, based on the extension we know
     // and the extension supported by our client implementation
-    dp->extensionsString = strdup(gExtensionString);
     for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         cnx->major = -1;
@@ -649,8 +725,9 @@
             res = EGL_TRUE;
         }
     }
-    free((void*)dp->extensionsString);
-    dp->extensionsString = 0;
+    
+    // TODO: all egl_object_t should be marked for termination
+    
     dp->numTotalConfigs = 0;
     clearTLS();
     return res;
@@ -868,21 +945,28 @@
                                     
 EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
 {
+    SurfaceRef _s(surface);
+    if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
     if (!validate_display_surface(dpy, surface))
         return EGL_FALSE;    
     egl_display_t const * const dp = get_display(dpy);
-    egl_surface_t const * const s = get_surface(surface);
 
+    egl_surface_t * const s = get_surface(surface);
     EGLBoolean result = s->cnx->hooks->egl.eglDestroySurface(
             dp->dpys[s->impl], s->surface);
-    
-    delete s;
+    if (result == EGL_TRUE) {
+        _s.terminate();
+    }
     return result;
 }
 
 EGLBoolean eglQuerySurface( EGLDisplay dpy, EGLSurface surface,
                             EGLint attribute, EGLint *value)
 {
+    SurfaceRef _s(surface);
+    if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
     if (!validate_display_surface(dpy, surface))
         return EGL_FALSE;    
     egl_display_t const * const dp = get_display(dpy);
@@ -915,66 +999,123 @@
 
 EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
 {
+    ContextRef _c(ctx);
+    if (!_c.get()) return setError(EGL_BAD_CONTEXT, EGL_FALSE);
+    
     if (!validate_display_context(dpy, ctx))
         return EGL_FALSE;
     egl_display_t const * const dp = get_display(dpy);
     egl_context_t * const c = get_context(ctx);
     EGLBoolean result = c->cnx->hooks->egl.eglDestroyContext(
             dp->dpys[c->impl], c->context);
-    delete c;
+    if (result == EGL_TRUE) {
+        _c.terminate();
+    }
     return result;
 }
 
 EGLBoolean eglMakeCurrent(  EGLDisplay dpy, EGLSurface draw,
                             EGLSurface read, EGLContext ctx)
 {
+    // get a reference to the object passed in
+    ContextRef _c(ctx);
+    SurfaceRef _d(draw);
+    SurfaceRef _r(read);
+
+    // validate the display and the context (if not EGL_NO_CONTEXT)
     egl_display_t const * const dp = get_display(dpy);
     if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
-
-    if (read == EGL_NO_SURFACE && draw  == EGL_NO_SURFACE &&
-            ctx == EGL_NO_CONTEXT) 
-    {
-        EGLBoolean result = EGL_TRUE;
-        ctx = getContext();
-        if (ctx) {
-            egl_context_t * const c = get_context(ctx);
-            result = c->cnx->hooks->egl.eglMakeCurrent(dp->dpys[c->impl], 0, 0, 0);
-            if (result == EGL_TRUE) {
-                setGlThreadSpecific(&gHooks[IMPL_NO_CONTEXT]);
-                setContext(EGL_NO_CONTEXT);
-            }
-        }
-        return result;
+    if ((ctx != EGL_NO_CONTEXT) && (!validate_display_context(dpy, ctx))) {
+        // EGL_NO_CONTEXT is valid
+        return EGL_FALSE;
     }
 
-    if (!validate_display_context(dpy, ctx))
-        return EGL_FALSE;    
-    
+    // these are the underlying implementation's object
+    EGLContext impl_ctx  = EGL_NO_CONTEXT;
     EGLSurface impl_draw = EGL_NO_SURFACE;
     EGLSurface impl_read = EGL_NO_SURFACE;
-    egl_context_t * const c = get_context(ctx);
+
+    // these are our objects structs passed in
+    egl_context_t       * c = NULL;
+    egl_surface_t const * d = NULL;
+    egl_surface_t const * r = NULL;
+
+    // these are the current objects structs
+    egl_context_t * cur_c = get_context(getContext());
+    egl_surface_t * cur_r = NULL;
+    egl_surface_t * cur_d = NULL;
+    
+    if (ctx != EGL_NO_CONTEXT) {
+        c = get_context(ctx);
+        cur_r = get_surface(c->read);
+        cur_d = get_surface(c->draw);
+        impl_ctx = c->context;
+    } else {
+        // no context given, use the implementation of the current context
+        if (cur_c == NULL) {
+            // no current context
+            if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) {
+                // calling eglMakeCurrent( ..., EGL_NO_CONTEXT, !=0, !=0);
+                return setError(EGL_BAD_PARAMETER, EGL_FALSE);
+            }
+            // not an error, there is just not current context.
+            return EGL_TRUE;
+        }
+    }
+
+    // retrieve the underlying implementation's draw EGLSurface
     if (draw != EGL_NO_SURFACE) {
-        egl_surface_t const * d = get_surface(draw);
-        if (!d) return setError(EGL_BAD_SURFACE, EGL_FALSE);
-        if (d->impl != c->impl)
+        d = get_surface(draw);
+        // make sure the EGLContext and EGLSurface passed in are for the same driver
+        if (c && d->impl != c->impl)
             return setError(EGL_BAD_MATCH, EGL_FALSE);
         impl_draw = d->surface;
     }
+
+    // retrieve the underlying implementation's read EGLSurface
     if (read != EGL_NO_SURFACE) {
-        egl_surface_t const * r = get_surface(read);
-        if (!r) return setError(EGL_BAD_SURFACE, EGL_FALSE);
-        if (r->impl != c->impl)
+        r = get_surface(read);
+        // make sure the EGLContext and EGLSurface passed in are for the same driver
+        if (c && r->impl != c->impl)
             return setError(EGL_BAD_MATCH, EGL_FALSE);
         impl_read = r->surface;
     }
-    EGLBoolean result = c->cnx->hooks->egl.eglMakeCurrent(
-            dp->dpys[c->impl], impl_draw, impl_read, c->context);
+
+    EGLBoolean result;
+
+    if (c) {
+        result = c->cnx->hooks->egl.eglMakeCurrent(
+                dp->dpys[c->impl], impl_draw, impl_read, impl_ctx);
+    } else {
+        result = cur_c->cnx->hooks->egl.eglMakeCurrent(
+                dp->dpys[cur_c->impl], impl_draw, impl_read, impl_ctx);
+    }
 
     if (result == EGL_TRUE) {
-        setGlThreadSpecific(c->cnx->hooks);
-        setContext(ctx);
-        c->read = read;
-        c->draw = draw;
+        // by construction, these are either 0 or valid (possibly terminated)
+        // it should be impossible for these to be invalid
+        ContextRef _cur_c(cur_c);
+        SurfaceRef _cur_r(cur_r);
+        SurfaceRef _cur_d(cur_d);
+
+        // cur_c has to be valid here (but could be terminated)
+        if (ctx != EGL_NO_CONTEXT) {
+            setGlThreadSpecific(c->cnx->hooks);
+            setContext(ctx);
+            _c.acquire();
+        } else {
+            setGlThreadSpecific(&gHooks[IMPL_NO_CONTEXT]);
+            setContext(EGL_NO_CONTEXT);
+        }
+        _cur_c.release();
+
+        _r.acquire();
+        _cur_r.release();
+        if (c) c->read = read;
+
+        _d.acquire();
+        _cur_d.release();
+        if (c) c->draw = draw;
     }
     return result;
 }
@@ -983,6 +1124,9 @@
 EGLBoolean eglQueryContext( EGLDisplay dpy, EGLContext ctx,
                             EGLint attribute, EGLint *value)
 {
+    ContextRef _c(ctx);
+    if (!_c.get()) return setError(EGL_BAD_CONTEXT, EGL_FALSE);
+
     if (!validate_display_context(dpy, ctx))
         return EGL_FALSE;    
     
@@ -1158,6 +1302,9 @@
 
 EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
 {
+    SurfaceRef _s(draw);
+    if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
     if (!validate_display_surface(dpy, draw))
         return EGL_FALSE;    
     egl_display_t const * const dp = get_display(dpy);
@@ -1168,6 +1315,9 @@
 EGLBoolean eglCopyBuffers(  EGLDisplay dpy, EGLSurface surface,
                             NativePixmapType target)
 {
+    SurfaceRef _s(surface);
+    if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
     if (!validate_display_surface(dpy, surface))
         return EGL_FALSE;    
     egl_display_t const * const dp = get_display(dpy);
@@ -1200,6 +1350,9 @@
 EGLBoolean eglSurfaceAttrib(
         EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
 {
+    SurfaceRef _s(surface);
+    if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
     if (!validate_display_surface(dpy, surface))
         return EGL_FALSE;    
     egl_display_t const * const dp = get_display(dpy);
@@ -1214,6 +1367,9 @@
 EGLBoolean eglBindTexImage(
         EGLDisplay dpy, EGLSurface surface, EGLint buffer)
 {
+    SurfaceRef _s(surface);
+    if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
     if (!validate_display_surface(dpy, surface))
         return EGL_FALSE;    
     egl_display_t const * const dp = get_display(dpy);
@@ -1228,6 +1384,9 @@
 EGLBoolean eglReleaseTexImage(
         EGLDisplay dpy, EGLSurface surface, EGLint buffer)
 {
+    SurfaceRef _s(surface);
+    if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
     if (!validate_display_surface(dpy, surface))
         return EGL_FALSE;    
     egl_display_t const * const dp = get_display(dpy);
@@ -1363,6 +1522,9 @@
 EGLBoolean eglLockSurfaceKHR(EGLDisplay dpy, EGLSurface surface,
         const EGLint *attrib_list)
 {
+    SurfaceRef _s(surface);
+    if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
     if (!validate_display_surface(dpy, surface))
         return EGL_FALSE;
 
@@ -1378,6 +1540,9 @@
 
 EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy, EGLSurface surface)
 {
+    SurfaceRef _s(surface);
+    if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
     if (!validate_display_surface(dpy, surface))
         return EGL_FALSE;
 
@@ -1395,6 +1560,8 @@
         EGLClientBuffer buffer, const EGLint *attrib_list)
 {
     if (ctx != EGL_NO_CONTEXT) {
+        ContextRef _c(ctx);
+        if (!_c.get()) return setError(EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
         if (!validate_display_context(dpy, ctx))
             return EGL_NO_IMAGE_KHR;
         egl_display_t const * const dp = get_display(dpy);
@@ -1443,16 +1610,15 @@
 
 EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
 {
-     egl_display_t const * const dp = get_display(dpy);
+    egl_display_t const * const dp = get_display(dpy);
      if (dp == 0) {
          return setError(EGL_BAD_DISPLAY, EGL_FALSE);
      }
 
-     egl_image_t* image = get_image(img);
-     if (!image->isValid()) {
-         return setError(EGL_BAD_PARAMETER, EGL_FALSE);
-     }
+     ImageRef _i(img);
+     if (!_i.get()) return setError(EGL_BAD_PARAMETER, EGL_FALSE);
 
+     egl_image_t* image = get_image(img);
      bool success = false;
      for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
          egl_connection_t* const cnx = &gEGLImpl[i];
@@ -1470,7 +1636,7 @@
      if (!success)
          return EGL_FALSE;
 
-     delete image;
+     _i.terminate();
 
      return EGL_TRUE;
 }
@@ -1483,6 +1649,9 @@
 EGLBoolean eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
         EGLint left, EGLint top, EGLint width, EGLint height)
 {
+    SurfaceRef _s(draw);
+    if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
     if (!validate_display_surface(dpy, draw))
         return EGL_FALSE;    
     egl_display_t const * const dp = get_display(dpy);
@@ -1496,6 +1665,9 @@
 
 EGLClientBuffer eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw)
 {
+    SurfaceRef _s(draw);
+    if (!_s.get()) return setError(EGL_BAD_SURFACE, (EGLClientBuffer*)0);
+
     if (!validate_display_surface(dpy, draw))
         return 0;    
     egl_display_t const * const dp = get_display(dpy);
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index e113680..73e7baa5 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -154,8 +154,9 @@
      * @see ServiceState#STATE_IN_SERVICE
      * @see ServiceState#STATE_OUT_OF_SERVICE
      * @see ServiceState#STATE_POWER_OFF
-     * @deprecated, @see #onSignalStrengthsChanged
+     * @deprecated see #onSignalStrengthsChanged
      */
+    @Deprecated
     public void onSignalStrengthChanged(int asu) {
         // default implementation empty
     }
diff --git a/telephony/java/android/telephony/gsm/SmsMessage.java b/telephony/java/android/telephony/gsm/SmsMessage.java
index 84dfca0..37ef912 100644
--- a/telephony/java/android/telephony/gsm/SmsMessage.java
+++ b/telephony/java/android/telephony/gsm/SmsMessage.java
@@ -345,6 +345,7 @@
      *         the number of code units used, and int[2] is the number of code
      *         units remaining until the next message. int[3] is the encoding
      *         type that should be used for the message.
+     * @deprecated Use android.telephony.SmsMessage.
      */
     @Deprecated
     public static int[] calculateLength(String messageBody, boolean use7bitOnly) {
diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java
index 6ebd8d6..ed8bc1e 100644
--- a/telephony/java/com/android/internal/telephony/CommandsInterface.java
+++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java
@@ -607,8 +607,9 @@
      *  ar.exception carries exception on failure
      *  ar.userObject contains the orignal value of result.obj
      *  ar.result contains a List of DataCallState
-     *  @deprecated
+     *  @deprecated Do not use.
      */
+    @Deprecated
     void getPDPContextList(Message result);
 
     /**
@@ -779,8 +780,9 @@
      * cause code returned as int[0] in Message.obj.response
      * returns an integer cause code defined in TS 24.008
      * section 6.1.3.1.3 or close approximation
-     * @deprecated
+     * @deprecated Do not use.
      */
+    @Deprecated
     void getLastPdpFailCause (Message result);
 
     /**
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index e187c37..cfb465e 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -453,7 +453,8 @@
     }
 
     protected synchronized void setEnabled(int id, boolean enable) {
-        if (DBG) Log.d(LOG_TAG, "setEnabled(" + id + ", " + enable + ')');
+        if (DBG) Log.d(LOG_TAG, "setEnabled(" + id + ", " + enable + ") with old state = " +
+                dataEnabled[id] + " and enabledCount = " + enabledCount);
         if (dataEnabled[id] != enable) {
             dataEnabled[id] = enable;
 
diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java
index 04a3749..9edb4c2 100644
--- a/telephony/java/com/android/internal/telephony/PhoneBase.java
+++ b/telephony/java/com/android/internal/telephony/PhoneBase.java
@@ -618,7 +618,7 @@
      * This should only be called in GSM mode.
      * Only here for some backward compatibility
      * issues concerning the GSMPhone class.
-     * @deprecated
+     * @deprecated Always returns null.
      */
     public List<PdpConnection> getCurrentPdpList() {
         return null;
diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
index bb04a43..3c1308b 100755
--- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
@@ -1084,8 +1084,9 @@
     }
 
     /**
-     * @deprecated
+     * @deprecated Do not use.
      */
+    @Deprecated
     public void getPdpContextList(Message response) {
         getDataCallList(response);
     }
@@ -1095,8 +1096,9 @@
     }
 
     /**
-     * @deprecated
+     * @deprecated Do not use.
      */
+    @Deprecated
     public List<PdpConnection> getCurrentPdpList() {
         ArrayList<DataConnection> connections = new ArrayList<DataConnection>();
         ArrayList<PdpConnection> pdp_list = new ArrayList<PdpConnection>();
diff --git a/test-runner/android/test/ProviderTestCase.java b/test-runner/android/test/ProviderTestCase.java
index 445b4eb..668e9f7 100644
--- a/test-runner/android/test/ProviderTestCase.java
+++ b/test-runner/android/test/ProviderTestCase.java
@@ -15,6 +15,7 @@
  * @deprecated this class extends InstrumentationTestCase but should extend AndroidTestCase. Use
  * ProviderTestCase2, which corrects this problem, instead.
  */
+@Deprecated
 public abstract class ProviderTestCase<T extends ContentProvider>
        extends InstrumentationTestCase {
 
diff --git a/test-runner/android/test/TouchUtils.java b/test-runner/android/test/TouchUtils.java
index 52d2ee8..962b2f9 100644
--- a/test-runner/android/test/TouchUtils.java
+++ b/test-runner/android/test/TouchUtils.java
@@ -565,6 +565,7 @@
      * {@link android.test.ActivityInstrumentationTestCase2}, which provides more options for
      * configuring the Activity under test
      */
+    @Deprecated
     public static int dragViewBy(InstrumentationTestCase test, View v, int gravity, int deltaX,
             int deltaY) {
         int[] xy = new int[2];
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 9a5127d..e8410cd 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -1238,10 +1238,16 @@
 
         NA = idents.size();
 
+        bool deprecated = false;
+        
         String16 comment = symbols->getComment(realClassName);
         fprintf(fp, "%s/** ", indentStr);
         if (comment.size() > 0) {
-            fprintf(fp, "%s\n", String8(comment).string());
+            String8 cmt(comment);
+            fprintf(fp, "%s\n", cmt.string());
+            if (strstr(cmt.string(), "@deprecated") != NULL) {
+                deprecated = true;
+            }
         } else {
             fprintf(fp, "Attributes that can be used with a %s.\n", nclassName.string());
         }
@@ -1317,6 +1323,10 @@
         }
         fprintf(fp, "%s */\n", getIndentSpace(indent));
 
+        if (deprecated) {
+            fprintf(fp, "%s@Deprecated\n", indentStr);
+        }
+        
         fprintf(fp,
                 "%spublic static final int[] %s = {\n"
                 "%s",
@@ -1365,11 +1375,17 @@
                 //printf("%s:%s/%s: 0x%08x\n", String8(package16).string(),
                 //    String8(attr16).string(), String8(name16).string(), typeSpecFlags);
                 const bool pub = (typeSpecFlags&ResTable_typeSpec::SPEC_PUBLIC) != 0;
-                    
+                
+                bool deprecated = false;
+                
                 fprintf(fp, "%s/**\n", indentStr);
                 if (comment.size() > 0) {
+                    String8 cmt(comment);
                     fprintf(fp, "%s  <p>\n%s  @attr description\n", indentStr, indentStr);
-                    fprintf(fp, "%s  %s\n", indentStr, String8(comment).string());
+                    fprintf(fp, "%s  %s\n", indentStr, cmt.string());
+                    if (strstr(cmt.string(), "@deprecated") != NULL) {
+                        deprecated = true;
+                    }
                 } else {
                     fprintf(fp,
                             "%s  <p>This symbol is the offset where the {@link %s.R.attr#%s}\n"
@@ -1381,7 +1397,11 @@
                             indentStr, nclassName.string());
                 }
                 if (typeComment.size() > 0) {
-                    fprintf(fp, "\n\n%s  %s\n", indentStr, String8(typeComment).string());
+                    String8 cmt(typeComment);
+                    fprintf(fp, "\n\n%s  %s\n", indentStr, cmt.string());
+                    if (strstr(cmt.string(), "@deprecated") != NULL) {
+                        deprecated = true;
+                    }
                 }
                 if (comment.size() > 0) {
                     if (pub) {
@@ -1399,6 +1419,9 @@
                 fprintf(fp, "%s  @attr name %s:%s\n", indentStr,
                         "android", String8(name).string());
                 fprintf(fp, "%s*/\n", indentStr);
+                if (deprecated) {
+                    fprintf(fp, "%s@Deprecated\n", indentStr);
+                }
                 fprintf(fp,
                         "%spublic static final int %s_%s = %d;\n",
                         indentStr, nclassName.string(),
@@ -1440,11 +1463,16 @@
         }
         String16 comment(sym.comment);
         bool haveComment = false;
+        bool deprecated = false;
         if (comment.size() > 0) {
             haveComment = true;
+            String8 cmt(comment);
             fprintf(fp,
                     "%s/** %s\n",
-                    getIndentSpace(indent), String8(comment).string());
+                    getIndentSpace(indent), cmt.string());
+            if (strstr(cmt.string(), "@deprecated") != NULL) {
+                deprecated = true;
+            }
         } else if (sym.isPublic && !includePrivate) {
             sym.sourcePos.warning("No comment for public symbol %s:%s/%s",
                 assets->getPackage().string(), className.string(),
@@ -1452,20 +1480,25 @@
         }
         String16 typeComment(sym.typeComment);
         if (typeComment.size() > 0) {
+            String8 cmt(typeComment);
             if (!haveComment) {
                 haveComment = true;
                 fprintf(fp,
-                        "%s/** %s\n",
-                        getIndentSpace(indent), String8(typeComment).string());
+                        "%s/** %s\n", getIndentSpace(indent), cmt.string());
             } else {
                 fprintf(fp,
-                        "%s %s\n",
-                        getIndentSpace(indent), String8(typeComment).string());
+                        "%s %s\n", getIndentSpace(indent), cmt.string());
+            }
+            if (strstr(cmt.string(), "@deprecated") != NULL) {
+                deprecated = true;
             }
         }
         if (haveComment) {
             fprintf(fp,"%s */\n", getIndentSpace(indent));
         }
+        if (deprecated) {
+            fprintf(fp, "%s@Deprecated\n", getIndentSpace(indent));
+        }
         fprintf(fp, "%spublic static final int %s=0x%08x;\n",
                 getIndentSpace(indent),
                 String8(name).string(), (int)sym.int32Val);
@@ -1484,17 +1517,25 @@
             return UNKNOWN_ERROR;
         }
         String16 comment(sym.comment);
+        bool deprecated = false;
         if (comment.size() > 0) {
+            String8 cmt(comment);
             fprintf(fp,
                     "%s/** %s\n"
                      "%s */\n",
-                    getIndentSpace(indent), String8(comment).string(),
+                    getIndentSpace(indent), cmt.string(),
                     getIndentSpace(indent));
+            if (strstr(cmt.string(), "@deprecated") != NULL) {
+                deprecated = true;
+            }
         } else if (sym.isPublic && !includePrivate) {
             sym.sourcePos.warning("No comment for public symbol %s:%s/%s",
                 assets->getPackage().string(), className.string(),
                 String8(sym.name).string());
         }
+        if (deprecated) {
+            fprintf(fp, "%s@Deprecated\n", getIndentSpace(indent));
+        }
         fprintf(fp, "%spublic static final String %s=\"%s\";\n",
                 getIndentSpace(indent),
                 String8(name).string(), sym.stringVal.string());
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index d8a03a9..27755ed9 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -960,7 +960,7 @@
          *
          * If this MulticastLock is not reference-counted, the first call to
          * {@code release} (after the radio was multicast locked using
-         * {@linke #acquire}) will unlock the multicast, and subsequent calls
+         * {@link #acquire}) will unlock the multicast, and subsequent calls
          * will be ignored.
          *
          * Note that if any other Wifi Multicast Locks are still outstanding