Merge "misc doc bug fixes" into jb-dev
diff --git a/core/java/android/app/DatePickerDialog.java b/core/java/android/app/DatePickerDialog.java
index 3f0b4d4..d168800 100644
--- a/core/java/android/app/DatePickerDialog.java
+++ b/core/java/android/app/DatePickerDialog.java
@@ -33,8 +33,8 @@
 /**
  * A simple dialog containing an {@link android.widget.DatePicker}.
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-datepicker.html">Date Picker
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/pickers.html">Pickers</a>
+ * guide.</p>
  */
 public class DatePickerDialog extends AlertDialog implements OnClickListener,
         OnDateChangedListener {
diff --git a/core/java/android/app/TimePickerDialog.java b/core/java/android/app/TimePickerDialog.java
index d773bc8..952227f 100644
--- a/core/java/android/app/TimePickerDialog.java
+++ b/core/java/android/app/TimePickerDialog.java
@@ -30,8 +30,8 @@
 /**
  * A dialog that prompts the user for the time of day using a {@link TimePicker}.
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-timepicker.html">Time Picker
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/pickers.html">Pickers</a>
+ * guide.</p>
  */
 public class TimePickerDialog extends AlertDialog
         implements OnClickListener, OnTimeChangedListener {
diff --git a/core/java/android/content/BroadcastReceiver.java b/core/java/android/content/BroadcastReceiver.java
index 9ddb2a6..446f1af 100644
--- a/core/java/android/content/BroadcastReceiver.java
+++ b/core/java/android/content/BroadcastReceiver.java
@@ -735,7 +735,7 @@
     
     /**
      * Control inclusion of debugging help for mismatched
-     * calls to {@ Context#registerReceiver(BroadcastReceiver, IntentFilter)
+     * calls to {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)
      * Context.registerReceiver()}.
      * If called with true, before given to registerReceiver(), then the
      * callstack of the following {@link Context#unregisterReceiver(BroadcastReceiver)
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 6de69b0..7e96ae6 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -1610,7 +1610,7 @@
      *
      * @param flags Additional option flags. Use any combination of
      * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
-     * {link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
+     * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
      *
      * @return A List of ApplicationInfo objects, one for each application that
      *         is installed on the device.  In the unlikely case of there being
diff --git a/core/java/android/net/DummyDataStateTracker.java b/core/java/android/net/DummyDataStateTracker.java
index 9f0f9cd..ccd96ff 100644
--- a/core/java/android/net/DummyDataStateTracker.java
+++ b/core/java/android/net/DummyDataStateTracker.java
@@ -123,7 +123,7 @@
      * Record the detailed state of a network, and if it is a
      * change from the previous state, send a notification to
      * any listeners.
-     * @param state the new @{code DetailedState}
+     * @param state the new {@code DetailedState}
      * @param reason a {@code String} indicating a reason for the state change,
      * if one was supplied. May be {@code null}.
      * @param extraInfo optional {@code String} providing extra information about the state change
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index 54a89ad..57f8d48 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -376,7 +376,7 @@
      * Record the detailed state of a network, and if it is a
      * change from the previous state, send a notification to
      * any listeners.
-     * @param state the new @{code DetailedState}
+     * @param state the new {@code DetailedState}
      * @param reason a {@code String} indicating a reason for the state change,
      * if one was supplied. May be {@code null}.
      * @param extraInfo optional {@code String} providing extra information about the state change
diff --git a/core/java/android/nfc/NdefRecord.java b/core/java/android/nfc/NdefRecord.java
index 8872335..ed1c5b3 100644
--- a/core/java/android/nfc/NdefRecord.java
+++ b/core/java/android/nfc/NdefRecord.java
@@ -70,7 +70,7 @@
  * indicate location with an NDEF message, provide support for chunking of
  * NDEF records, and to pack optional fields. This class does not expose
  * those details. To write an NDEF Record as binary you must first put it
- * into an @{link NdefMessage}, then call {@link NdefMessage#toByteArray()}.
+ * into an {@link NdefMessage}, then call {@link NdefMessage#toByteArray()}.
  * <p class="note">
  * {@link NdefMessage} and {@link NdefRecord} implementations are
  * always available, even on Android devices that do not have NFC hardware.
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index fbf512c..cb6c1dc 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -289,7 +289,7 @@
      * Constructs a StorageManager object through which an application can
      * can communicate with the systems mount service.
      * 
-     * @param tgtLooper The {@android.os.Looper} which events will be received on.
+     * @param tgtLooper The {@link android.os.Looper} which events will be received on.
      *
      * <p>Applications can get instance of this class by calling
      * {@link android.content.Context#getSystemService(java.lang.String)} with an argument
diff --git a/core/java/android/view/SurfaceHolder.java b/core/java/android/view/SurfaceHolder.java
index 2a16725..015a78e 100644
--- a/core/java/android/view/SurfaceHolder.java
+++ b/core/java/android/view/SurfaceHolder.java
@@ -155,7 +155,7 @@
 
     /**
      * Make the surface a fixed size.  It will never change from this size.
-     * When working with a {link SurfaceView}, this must be called from the
+     * When working with a {@link SurfaceView}, this must be called from the
      * same thread running the SurfaceView's window.
      * 
      * @param width The surface's width.
@@ -167,14 +167,14 @@
      * Allow the surface to resized based on layout of its container (this is
      * the default).  When this is enabled, you should monitor
      * {@link Callback#surfaceChanged} for changes to the size of the surface.
-     * When working with a {link SurfaceView}, this must be called from the
+     * When working with a {@link SurfaceView}, this must be called from the
      * same thread running the SurfaceView's window.
      */
     public void setSizeFromLayout();
 
     /**
      * Set the desired PixelFormat of the surface.  The default is OPAQUE.
-     * When working with a {link SurfaceView}, this must be called from the
+     * When working with a {@link SurfaceView}, this must be called from the
      * same thread running the SurfaceView's window.
      * 
      * @param format A constant from PixelFormat.
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index b1caa2f..f0ca302f 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2362,7 +2362,7 @@
      * with a stable layout.  (Note that you should avoid using
      * {@link #SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION} by itself.)
      *
-     * If you have set the window flag {@ WindowManager.LayoutParams#FLAG_FULLSCREEN}
+     * If you have set the window flag {@link WindowManager.LayoutParams#FLAG_FULLSCREEN}
      * to hide the status bar (instead of using {@link #SYSTEM_UI_FLAG_FULLSCREEN}),
      * then a hidden status bar will be considered a "stable" state for purposes
      * here.  This allows your UI to continually hide the status bar, while still
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 6ec0955..0c83a73 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -5206,7 +5206,7 @@
     }
 
     /**
-     * If {link #addStatesFromChildren} is true, refreshes this group's
+     * If {@link #addStatesFromChildren} is true, refreshes this group's
      * drawable state (to include the states from its children).
      */
     public void childDrawableStateChanged(View child) {
diff --git a/core/java/android/view/textservice/TextServicesManager.java b/core/java/android/view/textservice/TextServicesManager.java
index 161e8fb..81b36db 100644
--- a/core/java/android/view/textservice/TextServicesManager.java
+++ b/core/java/android/view/textservice/TextServicesManager.java
@@ -91,11 +91,11 @@
 
     /**
      * Get a spell checker session for the specified spell checker
-     * @param locale the locale for the spell checker. If {@param locale} is null and
+     * @param locale the locale for the spell checker. If {@code locale} is null and
      * referToSpellCheckerLanguageSettings is true, the locale specified in Settings will be
-     * returned. If {@param locale} is not null and referToSpellCheckerLanguageSettings is true,
-     * the locale specified in Settings will be returned only when it is same as {@param locale}.
-     * Exceptionally, when referToSpellCheckerLanguageSettings is true and {@param locale} is
+     * returned. If {@code locale} is not null and referToSpellCheckerLanguageSettings is true,
+     * the locale specified in Settings will be returned only when it is same as {@code locale}.
+     * Exceptionally, when referToSpellCheckerLanguageSettings is true and {@code locale} is
      * only language (e.g. "en"), the specified locale in Settings (e.g. "en_US") will be
      * selected.
      * @param listener a spell checker session lister for getting results from a spell checker.
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 119fcd3..e493653 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -65,8 +65,8 @@
  * href="{@docRoot}guide/topics/manifest/manifest-element.html">{@code <manifest>}</a>
  * element.</p>
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-webview.html">Web View
- * tutorial</a>.</p>
+ * <p>For more information, read
+ * <a href="{@docRoot}guide/webapps/webview.html">Building Web Apps in WebView</a>.</p>
  *
  * <h3>Basic usage</h3>
  *
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 19aef8e..437da59 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -16,8 +16,6 @@
 
 package android.widget;
 
-import com.android.internal.R;
-
 import android.content.Context;
 import android.content.Intent;
 import android.content.res.TypedArray;
@@ -69,6 +67,8 @@
 import android.view.inputmethod.InputConnectionWrapper;
 import android.view.inputmethod.InputMethodManager;
 
+import com.android.internal.R;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -1813,6 +1813,10 @@
         }
         ss.checkedItemCount = mCheckedItemCount;
 
+        if (mRemoteAdapter != null) {
+            mRemoteAdapter.saveRemoteViewsCache();
+        }
+
         return ss;
     }
 
@@ -5974,6 +5978,9 @@
         mDeferNotifyDataSetChanged = false;
         // Otherwise, create a new RemoteViewsAdapter for binding
         mRemoteAdapter = new RemoteViewsAdapter(getContext(), intent, this);
+        if (mRemoteAdapter.isDataReady()) {
+            setAdapter(mRemoteAdapter);
+        }
     }
 
     /**
diff --git a/core/java/android/widget/AdapterViewAnimator.java b/core/java/android/widget/AdapterViewAnimator.java
index c557963b..2266cea 100644
--- a/core/java/android/widget/AdapterViewAnimator.java
+++ b/core/java/android/widget/AdapterViewAnimator.java
@@ -813,6 +813,9 @@
     @Override
     public Parcelable onSaveInstanceState() {
         Parcelable superState = super.onSaveInstanceState();
+        if (mRemoteViewsAdapter != null) {
+            mRemoteViewsAdapter.saveRemoteViewsCache();
+        }
         return new SavedState(superState, mWhichChild);
     }
 
@@ -984,6 +987,9 @@
         mDeferNotifyDataSetChanged = false;
         // Otherwise, create a new RemoteViewsAdapter for binding
         mRemoteViewsAdapter = new RemoteViewsAdapter(getContext(), intent, this);
+        if (mRemoteViewsAdapter.isDataReady()) {
+            setAdapter(mRemoteViewsAdapter);
+        }
     }
 
     @Override
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index e5199f6..30dd17d 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -75,8 +75,8 @@
  * }
  * </pre>
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-autocomplete.html">Auto Complete
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/text.html">Text Fields</a>
+ * guide.</p>
  *
  * @attr ref android.R.styleable#AutoCompleteTextView_completionHint
  * @attr ref android.R.styleable#AutoCompleteTextView_completionThreshold
diff --git a/core/java/android/widget/Button.java b/core/java/android/widget/Button.java
index 99f4cae..2ac56ac 100644
--- a/core/java/android/widget/Button.java
+++ b/core/java/android/widget/Button.java
@@ -83,8 +83,8 @@
  * href="{@docRoot}guide/topics/resources/drawable-resource.html#StateList">State List
  * Drawable</a>.</p>
  *
- * <p>Also see the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a> for an example implementation of a button.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/button.html">Buttons</a>
+ * guide.</p>
  *
  * <p><strong>XML attributes</strong></p>
  * <p>
diff --git a/core/java/android/widget/CheckBox.java b/core/java/android/widget/CheckBox.java
index 858c415..f1804f8 100644
--- a/core/java/android/widget/CheckBox.java
+++ b/core/java/android/widget/CheckBox.java
@@ -44,8 +44,8 @@
  * }
  * </pre>
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/checkbox.html">Checkboxes</a>
+ * guide.</p>
  *  
  * <p><strong>XML attributes</strong></p> 
  * <p>
diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java
index 108b720..ac3bedb 100644
--- a/core/java/android/widget/DatePicker.java
+++ b/core/java/android/widget/DatePicker.java
@@ -53,8 +53,8 @@
  * displayed. Also the minimal and maximal date from which dates to be selected
  * can be customized.
  * <p>
- * See the <a href="{@docRoot}resources/tutorials/views/hello-datepicker.html">Date
- * Picker tutorial</a>.
+ * See the <a href="{@docRoot}guide/topics/ui/controls/pickers.html">Pickers</a>
+ * guide.
  * </p>
  * <p>
  * For a dialog using this view, see {@link android.app.DatePickerDialog}.
diff --git a/core/java/android/widget/EditText.java b/core/java/android/widget/EditText.java
index 2fd8768..57e51c2 100644
--- a/core/java/android/widget/EditText.java
+++ b/core/java/android/widget/EditText.java
@@ -38,8 +38,8 @@
  * EditText is a thin veneer over TextView that configures itself
  * to be editable.
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/text.html">Text Fields</a>
+ * guide.</p>
  * <p>
  * <b>XML attributes</b>
  * <p>
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java
index 8975109..ff8c0a1 100644
--- a/core/java/android/widget/GridView.java
+++ b/core/java/android/widget/GridView.java
@@ -37,8 +37,8 @@
  * A view that shows items in two-dimensional scrolling grid. The items in the
  * grid come from the {@link ListAdapter} associated with this view.
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-gridview.html">Grid
- * View tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/layout/gridview.html">Grid
+ * View</a> guide.</p>
  * 
  * @attr ref android.R.styleable#GridView_horizontalSpacing
  * @attr ref android.R.styleable#GridView_verticalSpacing
diff --git a/core/java/android/widget/ImageButton.java b/core/java/android/widget/ImageButton.java
index 59a8f28..379354ca 100644
--- a/core/java/android/widget/ImageButton.java
+++ b/core/java/android/widget/ImageButton.java
@@ -64,8 +64,8 @@
  * it will only be applied after {@code android:state_pressed} and {@code
  * android:state_focused} have both evaluated false.</p>
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/button.html">Buttons</a>
+ * guide.</p>
  *
  * <p><strong>XML attributes</strong></p>
  * <p>
diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java
index 2391898d..09c0129 100644
--- a/core/java/android/widget/LinearLayout.java
+++ b/core/java/android/widget/LinearLayout.java
@@ -41,8 +41,8 @@
  * {@link android.widget.LinearLayout.LayoutParams LinearLayout.LayoutParams}.
  * The default orientation is horizontal.
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-linearlayout.html">Linear Layout
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/layout/linear.html">Linear Layout</a>
+ * guide.</p>
  *
  * <p>
  * Also see {@link LinearLayout.LayoutParams android.widget.LinearLayout.LayoutParams}
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index d2e55d9..e011c13 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -57,8 +57,8 @@
  * A view that shows items in a vertically scrolling list. The items
  * come from the {@link ListAdapter} associated with this view.
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-listview.html">List View
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/layout/listview.html">List View</a>
+ * guide.</p>
  *
  * @attr ref android.R.styleable#ListView_entries
  * @attr ref android.R.styleable#ListView_divider
diff --git a/core/java/android/widget/RadioButton.java b/core/java/android/widget/RadioButton.java
index b1bb1c0..a0fef7d 100644
--- a/core/java/android/widget/RadioButton.java
+++ b/core/java/android/widget/RadioButton.java
@@ -38,8 +38,8 @@
  * a radio group, checking one radio button unchecks all the others.</p>
  * </p>
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/radiobutton.html">Radio Buttons</a>
+ * guide.</p>
  *
  * <p><strong>XML attributes</strong></p>
  * <p> 
diff --git a/core/java/android/widget/RatingBar.java b/core/java/android/widget/RatingBar.java
index 524d272..4d3c56c 100644
--- a/core/java/android/widget/RatingBar.java
+++ b/core/java/android/widget/RatingBar.java
@@ -43,9 +43,6 @@
  * <p>
  * The secondary progress should not be modified by the client as it is used
  * internally as the background for a fractionally filled star.
- *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a>.</p>
  * 
  * @attr ref android.R.styleable#RatingBar_numStars
  * @attr ref android.R.styleable#RatingBar_rating
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index 29cf000..569cf99 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -56,8 +56,8 @@
  * {@link #ALIGN_PARENT_BOTTOM}.
  * </p>
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-relativelayout.html">Relative
- * Layout tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/layout/relative.html">Relative
+ * Layout</a> guide.</p>
  *
  * <p>
  * Also see {@link android.widget.RelativeLayout.LayoutParams RelativeLayout.LayoutParams} for
diff --git a/core/java/android/widget/RemoteViewsAdapter.java b/core/java/android/widget/RemoteViewsAdapter.java
index 46ec923a..e9c753a 100644
--- a/core/java/android/widget/RemoteViewsAdapter.java
+++ b/core/java/android/widget/RemoteViewsAdapter.java
@@ -29,12 +29,16 @@
 import android.os.IBinder;
 import android.os.Looper;
 import android.os.Message;
+import android.os.Parcel;
+import android.os.Parcelable;
 import android.os.RemoteException;
 import android.util.Log;
+import android.util.Pair;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.MeasureSpec;
 import android.view.ViewGroup;
+import android.widget.RemoteViewsService.RemoteViewsFactory;
 
 import com.android.internal.widget.IRemoteViewsAdapterConnection;
 import com.android.internal.widget.IRemoteViewsFactory;
@@ -83,6 +87,26 @@
     private Handler mWorkerQueue;
     private Handler mMainQueue;
 
+    // We cache the FixedSizeRemoteViewsCaches across orientation. These are the related data
+    // structures;
+    private static final HashMap<Pair<Intent.FilterComparison, Integer>, Parcel>
+            sCachedRemoteViewsCaches = new HashMap<Pair<Intent.FilterComparison, Integer>,
+            Parcel>();
+    private static final HashMap<Pair<Intent.FilterComparison, Integer>, Runnable>
+            sRemoteViewsCacheRemoveRunnables = new HashMap<Pair<Intent.FilterComparison, Integer>,
+            Runnable>();
+    private static HandlerThread sCacheRemovalThread;
+    private static Handler sCacheRemovalQueue;
+
+    // We keep the cache around for a duration after onSaveInstanceState for use on re-inflation.
+    // If a new RemoteViewsAdapter with the same intent / widget id isn't constructed within this
+    // duration, the cache is dropped.
+    private static final int REMOTE_VIEWS_CACHE_DURATION = 5000;
+
+    // Used to indicate to the AdapterView that it can use this Adapter immediately after
+    // construction (happens when we have a cached FixedSizeRemoteViewsCache).
+    private boolean mDataReady = false;
+
     /**
      * An interface for the RemoteAdapter to notify other classes when adapters
      * are actually connected to/disconnected from their actual services.
@@ -246,7 +270,7 @@
      * A FrameLayout which contains a loading view, and manages the re/applying of RemoteViews when
      * they are loaded.
      */
-    private class RemoteViewsFrameLayout extends FrameLayout {
+    private static class RemoteViewsFrameLayout extends FrameLayout {
         public RemoteViewsFrameLayout(Context context) {
             super(context);
         }
@@ -301,7 +325,7 @@
          * Notifies each of the RemoteViewsFrameLayouts associated with a particular position that
          * the associated RemoteViews has loaded.
          */
-        public void notifyOnRemoteViewsLoaded(int position, RemoteViews view, int typeId) {
+        public void notifyOnRemoteViewsLoaded(int position, RemoteViews view) {
             if (view == null) return;
 
             final Integer pos = position;
@@ -331,7 +355,7 @@
     /**
      * The meta-data associated with the cache in it's current state.
      */
-    private class RemoteViewsMetaData {
+    private static class RemoteViewsMetaData implements Parcelable {
         int count;
         int viewTypeCount;
         boolean hasStableIds;
@@ -350,6 +374,51 @@
             reset();
         }
 
+        public RemoteViewsMetaData(Parcel src) {
+            count = src.readInt();
+            viewTypeCount = src.readInt();
+            hasStableIds = src.readInt() == 0 ? false : true;
+            mFirstViewHeight = src.readInt();
+            if (src.readInt() != 0) {
+                mUserLoadingView = new RemoteViews(src);
+            }
+            if (src.readInt() != 0) {
+                mFirstView = new RemoteViews(src);
+            }
+            int count = src.readInt();
+            for (int i = 0; i < count; i++) {
+                mTypeIdIndexMap.put(src.readInt(), src.readInt());
+            }
+        }
+
+        @Override
+        public void writeToParcel(Parcel dest, int flags) {
+            dest.writeInt(count);
+            dest.writeInt(viewTypeCount);
+            dest.writeInt(hasStableIds ? 1 : 0);
+            dest.writeInt(mFirstViewHeight);
+            dest.writeInt(mUserLoadingView != null ? 1 : 0);
+            if (mUserLoadingView != null) {
+                mUserLoadingView.writeToParcel(dest, flags);
+            }
+            dest.writeInt(mFirstView != null ? 1 : 0);
+            if (mFirstView != null) {
+                mFirstView.writeToParcel(dest, flags);
+            }
+
+            int count = mTypeIdIndexMap.size();
+            dest.writeInt(count);
+            for (Integer key: mTypeIdIndexMap.keySet()) {
+                dest.writeInt(key);
+                dest.writeInt(mTypeIdIndexMap.get(key));
+            }
+        }
+
+        @Override
+        public int describeContents() {
+            return 0;
+        }
+
         public void set(RemoteViewsMetaData d) {
             synchronized (d) {
                 count = d.count;
@@ -390,14 +459,23 @@
             }
         }
 
+        public boolean isViewTypeInRange(int typeId) {
+            int mappedType = getMappedViewType(typeId);
+            if (mappedType >= viewTypeCount) {
+                return false;
+            } else {
+                return true;
+            }
+        }
+
         private RemoteViewsFrameLayout createLoadingView(int position, View convertView,
-                ViewGroup parent) {
+                ViewGroup parent, Object lock, LayoutInflater layoutInflater) {
             // Create and return a new FrameLayout, and setup the references for this position
             final Context context = parent.getContext();
             RemoteViewsFrameLayout layout = new RemoteViewsFrameLayout(context);
 
             // Create a new loading view
-            synchronized (mCache) {
+            synchronized (lock) {
                 boolean customLoadingViewAvailable = false;
 
                 if (mUserLoadingView != null) {
@@ -425,7 +503,7 @@
                             mFirstViewHeight = firstView.getMeasuredHeight();
                             mFirstView = null;
                         } catch (Exception e) {
-                            float density = mContext.getResources().getDisplayMetrics().density;
+                            float density = context.getResources().getDisplayMetrics().density;
                             mFirstViewHeight = (int)
                                     Math.round(sDefaultLoadingViewHeight * density);
                             mFirstView = null;
@@ -434,7 +512,7 @@
                     }
 
                     // Compose the loading view text
-                    TextView loadingTextView = (TextView) mLayoutInflater.inflate(
+                    TextView loadingTextView = (TextView) layoutInflater.inflate(
                             com.android.internal.R.layout.remote_views_adapter_default_loading_view,
                             layout, false);
                     loadingTextView.setHeight(mFirstViewHeight);
@@ -451,7 +529,7 @@
     /**
      * The meta-data associated with a single item in the cache.
      */
-    private class RemoteViewsIndexMetaData {
+    private static class RemoteViewsIndexMetaData implements Parcelable {
         int typeId;
         long itemId;
         boolean isRequested;
@@ -460,20 +538,39 @@
             set(v, itemId, requested);
         }
 
+        public RemoteViewsIndexMetaData(Parcel src) {
+            typeId = src.readInt();
+            itemId = src.readLong();
+        }
+
+        @Override
+        public void writeToParcel(Parcel dest, int flags) {
+            dest.writeInt(typeId);
+            dest.writeLong(itemId);
+        }
+
+        @Override
+        public int describeContents() {
+            return 0;
+        }
+
         public void set(RemoteViews v, long id, boolean requested) {
             itemId = id;
-            if (v != null)
+            if (v != null) {
                 typeId = v.getLayoutId();
-            else
+            } else {
                 typeId = 0;
+            }
             isRequested = requested;
         }
+
+
     }
 
     /**
      *
      */
-    private class FixedSizeRemoteViewsCache {
+    private static class FixedSizeRemoteViewsCache implements Parcelable {
         private static final String TAG = "FixedSizeRemoteViewsCache";
 
         // The meta data related to all the RemoteViews, ie. count, is stable, etc.
@@ -535,6 +632,57 @@
             mLoadIndices = new HashSet<Integer>();
         }
 
+        public FixedSizeRemoteViewsCache(Parcel src) {
+            mMaxCount = src.readInt();
+            mMaxCountSlack = src.readInt();
+            mPreloadLowerBound = src.readInt();
+            mPreloadUpperBound = src.readInt();
+            mMetaData = new RemoteViewsMetaData(src);
+            int count = src.readInt();
+            mIndexMetaData = new HashMap<Integer, RemoteViewsIndexMetaData>();
+            for (int i = 0; i < count; i++) {
+                mIndexMetaData.put(src.readInt(), new RemoteViewsIndexMetaData(src));
+            }
+            count = src.readInt();
+            mIndexRemoteViews = new HashMap<Integer, RemoteViews>();
+            for (int i = 0; i < count; i++) {
+                mIndexRemoteViews.put(src.readInt(), new RemoteViews(src));
+            }
+
+            mTemporaryMetaData = new RemoteViewsMetaData();
+            mRequestedIndices = new HashSet<Integer>();
+            mLastRequestedIndex = -1;
+            mLoadIndices = new HashSet<Integer>();
+        }
+
+        @Override
+        public void writeToParcel(Parcel dest, int flags) {
+            dest.writeInt(mMaxCount);
+            dest.writeInt(mMaxCountSlack);
+            dest.writeInt(mPreloadLowerBound);
+            dest.writeInt(mPreloadUpperBound);
+            mMetaData.writeToParcel(dest, 0);
+
+            // We write the index data and cache
+            int count = mIndexMetaData.size();
+            dest.writeInt(count);
+            for (Integer key: mIndexMetaData.keySet()) {
+                dest.writeInt(key);
+                mIndexMetaData.get(key).writeToParcel(dest, flags);
+            }
+            count = mIndexRemoteViews.size();
+            dest.writeInt(count);
+            for (Integer key: mIndexRemoteViews.keySet()) {
+                dest.writeInt(key);
+                mIndexRemoteViews.get(key).writeToParcel(dest, flags);
+            }
+        }
+
+        @Override
+        public int describeContents() {
+            return 0;
+        }
+
         public void insert(int position, RemoteViews v, long itemId, boolean isRequested) {
             // Trim the cache if we go beyond the count
             if (mIndexRemoteViews.size() >= mMaxCount) {
@@ -737,11 +885,30 @@
         mWorkerQueue = new Handler(mWorkerThread.getLooper());
         mMainQueue = new Handler(Looper.myLooper(), this);
 
+        if (sCacheRemovalThread == null) {
+            sCacheRemovalThread = new HandlerThread("RemoteViewsAdapter-cachePruner");
+            sCacheRemovalThread.start();
+            sCacheRemovalQueue = new Handler(sCacheRemovalThread.getLooper());
+        }
+
         // Initialize the cache and the service connection on startup
-        mCache = new FixedSizeRemoteViewsCache(sDefaultCacheSize);
         mCallback = new WeakReference<RemoteAdapterConnectionCallback>(callback);
         mServiceConnection = new RemoteViewsAdapterServiceConnection(this);
-        requestBindService();
+
+        Pair<Intent.FilterComparison, Integer> key = new Pair<Intent.FilterComparison, Integer>
+                (new Intent.FilterComparison(mIntent), mAppWidgetId);
+
+        synchronized(sCachedRemoteViewsCaches) {
+            if (sCachedRemoteViewsCaches.containsKey(key)) {
+                Parcel src = sCachedRemoteViewsCaches.get(key);
+                src.setDataPosition(0);
+                mCache = new FixedSizeRemoteViewsCache(src);
+                mDataReady = true;
+            } else {
+                mCache = new FixedSizeRemoteViewsCache(sDefaultCacheSize);
+                requestBindService();
+            }
+        }
     }
 
     @Override
@@ -755,6 +922,44 @@
         }
     }
 
+    public boolean isDataReady() {
+        return mDataReady;
+    }
+
+    public void saveRemoteViewsCache() {
+        final Pair<Intent.FilterComparison, Integer> key = new Pair<Intent.FilterComparison,
+                Integer> (new Intent.FilterComparison(mIntent), mAppWidgetId);
+
+        synchronized(sCachedRemoteViewsCaches) {
+            // If we already have a remove runnable posted for this key, remove it.
+            if (sRemoteViewsCacheRemoveRunnables.containsKey(key)) {
+                sCacheRemovalQueue.removeCallbacks(sRemoteViewsCacheRemoveRunnables.get(key));
+                sRemoteViewsCacheRemoveRunnables.remove(key);
+            }
+
+            Parcel p = Parcel.obtain();
+            synchronized(mCache) {
+                mCache.writeToParcel(p, 0);
+            }
+            sCachedRemoteViewsCaches.put(key, p);
+            Runnable r = new Runnable() {
+                @Override
+                public void run() {
+                    synchronized (sCachedRemoteViewsCaches) {
+                        if (sCachedRemoteViewsCaches.containsKey(key)) {
+                            sCachedRemoteViewsCaches.remove(key);
+                        }
+                        if (sRemoteViewsCacheRemoveRunnables.containsKey(key)) {
+                            sRemoteViewsCacheRemoveRunnables.remove(key);
+                        }
+                    }
+                }
+            };
+            sRemoteViewsCacheRemoveRunnables.put(key, r);
+            sCacheRemovalQueue.postDelayed(r, REMOTE_VIEWS_CACHE_DURATION);
+        }
+    }
+
     private void loadNextIndexInBackground() {
         mWorkerQueue.post(new Runnable() {
             @Override
@@ -861,21 +1066,36 @@
                     "returned from RemoteViewsFactory.");
             return;
         }
-        synchronized (mCache) {
-            // Cache the RemoteViews we loaded
-            mCache.insert(position, remoteViews, itemId, isRequested);
 
-            // Notify all the views that we have previously returned for this index that
-            // there is new data for it.
-            final RemoteViews rv = remoteViews;
-            final int typeId = mCache.getMetaDataAt(position).typeId;
-            if (notifyWhenLoaded) {
-                mMainQueue.post(new Runnable() {
-                    @Override
-                    public void run() {
-                        mRequestedViews.notifyOnRemoteViewsLoaded(position, rv, typeId);
-                    }
-                });
+        int layoutId = remoteViews.getLayoutId();
+        RemoteViewsMetaData metaData = mCache.getMetaData();
+        boolean viewTypeInRange;
+        synchronized (metaData) {
+            viewTypeInRange = metaData.isViewTypeInRange(layoutId);
+        }
+        synchronized (mCache) {
+            if (viewTypeInRange) {
+                // Cache the RemoteViews we loaded
+                mCache.insert(position, remoteViews, itemId, isRequested);
+
+                // Notify all the views that we have previously returned for this index that
+                // there is new data for it.
+                final RemoteViews rv = remoteViews;
+                if (notifyWhenLoaded) {
+                    mMainQueue.post(new Runnable() {
+                        @Override
+                        public void run() {
+                            mRequestedViews.notifyOnRemoteViewsLoaded(position, rv);
+                        }
+                    });
+                }
+            } else {
+                // We need to log an error here, as the the view type count specified by the
+                // factory is less than the number of view types returned. We don't return this
+                // view to the AdapterView, as this will cause an exception in the hosting process,
+                // which contains the associated AdapterView.
+                Log.e(TAG, "Error: widget's RemoteViewsFactory returns more view types than " +
+                        " indicated by getViewTypeCount() ");
             }
         }
     }
@@ -1010,7 +1230,8 @@
                     RemoteViewsFrameLayout loadingView = null;
                     final RemoteViewsMetaData metaData = mCache.getMetaData();
                     synchronized (metaData) {
-                        loadingView = metaData.createLoadingView(position, convertView, parent);
+                        loadingView = metaData.createLoadingView(position, convertView, parent,
+                                mCache, mLayoutInflater);
                     }
                     return loadingView;
                 } finally {
@@ -1022,7 +1243,8 @@
                 RemoteViewsFrameLayout loadingView = null;
                 final RemoteViewsMetaData metaData = mCache.getMetaData();
                 synchronized (metaData) {
-                    loadingView = metaData.createLoadingView(position, convertView, parent);
+                    loadingView = metaData.createLoadingView(position, convertView, parent,
+                            mCache, mLayoutInflater);
                 }
 
                 mRequestedViews.add(position, loadingView);
diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java
index 36d1ee0..64834b2 100644
--- a/core/java/android/widget/Spinner.java
+++ b/core/java/android/widget/Spinner.java
@@ -39,10 +39,16 @@
  * The items in the Spinner come from the {@link Adapter} associated with
  * this view.
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-spinner.html">Spinner
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/spinner.html">Spinners</a> guide.</p>
  *
+ * @attr ref android.R.styleable#Spinner_dropDownHorizontalOffset
+ * @attr ref android.R.styleable#Spinner_dropDownSelector
+ * @attr ref android.R.styleable#Spinner_dropDownVerticalOffset
+ * @attr ref android.R.styleable#Spinner_dropDownWidth
+ * @attr ref android.R.styleable#Spinner_gravity
+ * @attr ref android.R.styleable#Spinner_popupBackground
  * @attr ref android.R.styleable#Spinner_prompt
+ * @attr ref android.R.styleable#Spinner_spinnerMode
  */
 @Widget
 public class Spinner extends AbsSpinner implements OnClickListener {
@@ -409,6 +415,7 @@
     /**
      * <p>A spinner does not support item click events. Calling this method
      * will raise an exception.</p>
+     * <p>Instead use {@link AdapterView#setOnItemSelectedListener}.
      *
      * @param l this listener will be ignored
      */
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index 471f259..56f6651 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -53,6 +53,17 @@
  * {@link #setSwitchTextAppearance(android.content.Context, int) switchTextAppearance} and
  * the related seSwitchTypeface() methods control that of the thumb.
  *
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/togglebutton.html">Toggle Buttons</a>
+ * guide.</p>
+ *
+ * @attr ref android.R.styleable#Switch_textOn
+ * @attr ref android.R.styleable#Switch_textOff
+ * @attr ref android.R.styleable#Switch_switchMinWidth
+ * @attr ref android.R.styleable#Switch_switchPadding
+ * @attr ref android.R.styleable#Switch_switchTextAppearance
+ * @attr ref android.R.styleable#Switch_thumb
+ * @attr ref android.R.styleable#Switch_thumbTextPadding
+ * @attr ref android.R.styleable#Switch_track
  */
 public class Switch extends CompoundButton {
     private static final int TOUCH_MODE_IDLE = 0;
diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java
index 18f7a91..cb9ed61 100644
--- a/core/java/android/widget/TimePicker.java
+++ b/core/java/android/widget/TimePicker.java
@@ -48,8 +48,8 @@
  * or 'P' to pick. For a dialog using this view, see
  * {@link android.app.TimePickerDialog}.
  *<p>
- * See the <a href="{@docRoot}resources/tutorials/views/hello-timepicker.html">Time Picker
- * tutorial</a>.
+ * See the <a href="{@docRoot}guide/topics/ui/controls/pickers.html">Pickers</a>
+ * guide.
  * </p>
  */
 @Widget
diff --git a/core/java/android/widget/ToggleButton.java b/core/java/android/widget/ToggleButton.java
index 4beee96..cedc777 100644
--- a/core/java/android/widget/ToggleButton.java
+++ b/core/java/android/widget/ToggleButton.java
@@ -31,8 +31,8 @@
  * Displays checked/unchecked states as a button
  * with a "light" indicator and by default accompanied with the text "ON" or "OFF".
  *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/togglebutton.html">Toggle Buttons</a>
+ * guide.</p>
  * 
  * @attr ref android.R.styleable#ToggleButton_textOn
  * @attr ref android.R.styleable#ToggleButton_textOff
diff --git a/core/res/res/values-mcc208-mnc01/config.xml b/core/res/res/values-mcc208-mnc01/config.xml
new file mode 100755
index 0000000..c1489b1
--- /dev/null
+++ b/core/res/res/values-mcc208-mnc01/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+     for different hardware and product builds.  Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+    <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+    <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+    <integer-array translatable="false" name="config_tether_upstream_types">
+        <item>1</item>
+        <item>4</item>
+        <item>7</item>
+        <item>9</item>
+    </integer-array>
+
+    <!-- String containing the apn value for tethering.  May be overriden by secure settings
+         TETHER_DUN_APN.  Value is a comma separated series of strings:
+         "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+         note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+    <string translatable="false" name="config_tether_apndata">Orange Internet,orange.fr,,,,,,orange,orange,,208,01,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc214-mnc03/config.xml b/core/res/res/values-mcc214-mnc03/config.xml
new file mode 100755
index 0000000..02f1475
--- /dev/null
+++ b/core/res/res/values-mcc214-mnc03/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+     for different hardware and product builds.  Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+    <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+    <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+    <integer-array translatable="false" name="config_tether_upstream_types">
+        <item>1</item>
+        <item>4</item>
+        <item>7</item>
+        <item>9</item>
+    </integer-array>
+
+    <!-- String containing the apn value for tethering.  May be overriden by secure settings
+         TETHER_DUN_APN.  Value is a comma separated series of strings:
+         "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+         note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+    <string translatable="false" name="config_tether_apndata">Orange Internet PC,internet,,,,,,orange,orange,,214,03,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc214-mnc07/config.xml b/core/res/res/values-mcc214-mnc07/config.xml
new file mode 100755
index 0000000..4e3fa16
--- /dev/null
+++ b/core/res/res/values-mcc214-mnc07/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+     for different hardware and product builds.  Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+    <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+    <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+    <integer-array translatable="false" name="config_tether_upstream_types">
+        <item>1</item>
+        <item>4</item>
+        <item>7</item>
+        <item>9</item>
+    </integer-array>
+
+    <!-- String containing the apn value for tethering.  May be overriden by secure settings
+         TETHER_DUN_APN.  Value is a comma separated series of strings:
+         "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+         note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+    <string translatable="false" name="config_tether_apndata">Conexión compartida,movistar.es,,,,,,MOVISTAR,MOVISTAR,,214,07,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc222-mnc01/config.xml b/core/res/res/values-mcc222-mnc01/config.xml
new file mode 100755
index 0000000..6bb1196
--- /dev/null
+++ b/core/res/res/values-mcc222-mnc01/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+     for different hardware and product builds.  Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+    <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+    <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+    <integer-array translatable="false" name="config_tether_upstream_types">
+        <item>1</item>
+        <item>4</item>
+        <item>7</item>
+        <item>9</item>
+    </integer-array>
+
+    <!-- String containing the apn value for tethering.  May be overriden by secure settings
+         TETHER_DUN_APN.  Value is a comma separated series of strings:
+         "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+         note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+    <string translatable="false" name="config_tether_apndata">TIM WEB,ibox.tim.it,,,,,,,,,222,01,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc222-mnc10/config.xml b/core/res/res/values-mcc222-mnc10/config.xml
new file mode 100755
index 0000000..24dd71c
--- /dev/null
+++ b/core/res/res/values-mcc222-mnc10/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+     for different hardware and product builds.  Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+    <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+    <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+    <integer-array translatable="false" name="config_tether_upstream_types">
+        <item>1</item>
+        <item>4</item>
+        <item>7</item>
+        <item>9</item>
+    </integer-array>
+
+    <!-- String containing the apn value for tethering.  May be overriden by secure settings
+         TETHER_DUN_APN.  Value is a comma separated series of strings:
+         "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+         note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+    <string translatable="false" name="config_tether_apndata">Tethering Internet,web.omnitel.it,,,,,,,,,222,10,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc234-mnc33/config.xml b/core/res/res/values-mcc234-mnc33/config.xml
new file mode 100755
index 0000000..d79d212
--- /dev/null
+++ b/core/res/res/values-mcc234-mnc33/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+     for different hardware and product builds.  Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+    <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+    <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+    <integer-array translatable="false" name="config_tether_upstream_types">
+        <item>1</item>
+        <item>4</item>
+        <item>7</item>
+        <item>9</item>
+    </integer-array>
+
+    <!-- String containing the apn value for tethering.  May be overriden by secure settings
+         TETHER_DUN_APN.  Value is a comma separated series of strings:
+         "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+         note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+    <string translatable="false" name="config_tether_apndata">Consumer Broadband,consumerbroadband,,,,,,,,,234,33,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc302-mnc370/config.xml b/core/res/res/values-mcc302-mnc370/config.xml
new file mode 100755
index 0000000..b1d363f
--- /dev/null
+++ b/core/res/res/values-mcc302-mnc370/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+     for different hardware and product builds.  Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+    <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+    <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+    <integer-array translatable="false" name="config_tether_upstream_types">
+        <item>1</item>
+        <item>4</item>
+        <item>7</item>
+        <item>9</item>
+    </integer-array>
+
+    <!-- String containing the apn value for tethering.  May be overriden by secure settings
+         TETHER_DUN_APN.  Value is a comma separated series of strings:
+         "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+         note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+    <string translatable="false" name="config_tether_apndata">Fido Tethering,isp.fido.apn,,,,,,,,,302,370,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc302-mnc660/config.xml b/core/res/res/values-mcc302-mnc660/config.xml
new file mode 100755
index 0000000..37853cf
--- /dev/null
+++ b/core/res/res/values-mcc302-mnc660/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+     for different hardware and product builds.  Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+    <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+    <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+    <integer-array translatable="false" name="config_tether_upstream_types">
+        <item>1</item>
+        <item>4</item>
+        <item>7</item>
+        <item>9</item>
+    </integer-array>
+
+    <!-- String containing the apn value for tethering.  May be overriden by secure settings
+         TETHER_DUN_APN.  Value is a comma separated series of strings:
+         "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+         note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+    <string translatable="false" name="config_tether_apndata">MTS -Tethering,internet.mts,,,,,,,,,302,660,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc302-mnc720/config.xml b/core/res/res/values-mcc302-mnc720/config.xml
new file mode 100755
index 0000000..40ef939
--- /dev/null
+++ b/core/res/res/values-mcc302-mnc720/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+     for different hardware and product builds.  Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+    <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+    <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+    <integer-array translatable="false" name="config_tether_upstream_types">
+        <item>1</item>
+        <item>4</item>
+        <item>7</item>
+        <item>9</item>
+    </integer-array>
+
+    <!-- String containing the apn value for tethering.  May be overriden by secure settings
+         TETHER_DUN_APN.  Value is a comma separated series of strings:
+         "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+         note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+    <string translatable="false" name="config_tether_apndata">Rogers Tethering,isp.apn,,,,,,,,,302,720,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc340-mnc01/config.xml b/core/res/res/values-mcc340-mnc01/config.xml
new file mode 100755
index 0000000..fb71f3bc
--- /dev/null
+++ b/core/res/res/values-mcc340-mnc01/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+     for different hardware and product builds.  Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+    <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+    <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+    <integer-array translatable="false" name="config_tether_upstream_types">
+        <item>1</item>
+        <item>4</item>
+        <item>7</item>
+        <item>9</item>
+    </integer-array>
+
+    <!-- String containing the apn value for tethering.  May be overriden by secure settings
+         TETHER_DUN_APN.  Value is a comma separated series of strings:
+         "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+         note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+    <string translatable="false" name="config_tether_apndata">Orangeweb,orangeweb,,,,,,orange,orange,,340,01,1,DUN</string>
+</resources>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index ccc85a3..a2e15e6 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -249,8 +249,11 @@
     <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
     <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
     <integer-array translatable="false" name="config_tether_upstream_types">
+        <item>0</item>
         <item>1</item>
-        <item>4</item>
+        <item>5</item>
+        <item>7</item>
+        <item>9</item>
     </integer-array>
 
     <!-- If the DUN connection for this CDMA device supports more than just DUN -->
diff --git a/media/java/android/media/MediaExtractor.java b/media/java/android/media/MediaExtractor.java
index 9f10cb0..687d3a5 100644
--- a/media/java/android/media/MediaExtractor.java
+++ b/media/java/android/media/MediaExtractor.java
@@ -295,7 +295,7 @@
      * Returns true iff we are caching data and the cache has reached the
      * end of the data stream (for now, a future seek may of course restart
      * the fetching of data).
-     * This API only returns a meaningful result if {link #getCachedDuration}
+     * This API only returns a meaningful result if {@link #getCachedDuration}
      * indicates the presence of a cache, i.e. does NOT return -1.
      */
     public native boolean hasCacheReachedEndOfStream();
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 870a4a9..cd25865b 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -706,7 +706,7 @@
      * surface rendering area. When the surface has the same aspect ratio
      * as the content, the aspect ratio of the content is maintained;
      * otherwise, the aspect ratio of the content is not maintained when video
-     * is being rendered. Unlike {@ #VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING},
+     * is being rendered. Unlike {@link #VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING},
      * there is no content cropping with this video scaling mode.
      */
     public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT = 1;
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 637c403..10849f6 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -84,26 +84,6 @@
             </intent-filter>
         </receiver>
 
-        <!-- should you need to launch the screensaver, this is a good way to do it -->
-        <activity android:name=".DreamsDockLauncher"
-                android:theme="@android:style/Theme.Dialog"
-                android:label="@string/dreams_dock_launcher">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
-        <!-- launch screensaver on (desk) dock event -->
-        <receiver android:name=".DreamsDockLauncher$DockEventReceiver" 
-            android:exported="true"
-            >
-            <intent-filter>
-                <action android:name="android.intent.action.DOCK_EVENT" />
-            </intent-filter>
-        </receiver>
-
-
         <activity android:name=".usb.UsbStorageActivity"
                   android:label="@*android:string/usb_storage_activity_title"
                   android:excludeFromRecents="true">
diff --git a/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java b/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java
deleted file mode 100644
index 73249b4..0000000
--- a/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.android.systemui;
-
-import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.provider.Settings;
-import android.util.Slog;
-
-public class DreamsDockLauncher extends Activity {
-    private static final String TAG = "DreamsDockLauncher";
-
-    // Launch the screen saver if started as an activity.
-    @Override
-    protected void onCreate (Bundle icicle) {
-        super.onCreate(icicle);
-        launchDream(this);
-        finish();
-    }
-
-    private static void launchDream(Context context) {
-        try {
-            String component = Settings.Secure.getString(
-                    context.getContentResolver(), Settings.Secure.SCREENSAVER_COMPONENT);
-            if (component == null) {
-                component = context.getResources().getString(
-                    com.android.internal.R.string.config_defaultDreamComponent);
-            }
-            if (component != null) {
-                // dismiss the notification shade, recents, etc.
-                context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
-
-                ComponentName cn = ComponentName.unflattenFromString(component);
-                Intent zzz = new Intent(Intent.ACTION_MAIN)
-                    .setComponent(cn)
-                    .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
-                            | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
-                            | Intent.FLAG_ACTIVITY_NO_USER_ACTION
-                            | Intent.FLAG_FROM_BACKGROUND
-                            | Intent.FLAG_ACTIVITY_NO_HISTORY
-                        );
-                Slog.v(TAG, "Starting screen saver on dock event: " + component);
-                context.startActivity(zzz);
-            } else {
-                Slog.e(TAG, "Couldn't start screen saver: none selected");
-            }
-        } catch (android.content.ActivityNotFoundException exc) {
-            // no screensaver? give up
-            Slog.e(TAG, "Couldn't start screen saver: none installed");
-        }
-    }
-
-    // Trap low-level dock events and launch the screensaver.
-    public static class DockEventReceiver extends BroadcastReceiver {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            final boolean activateOnDock = 0 != Settings.Secure.getInt(
-                context.getContentResolver(),
-                Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK, 0);
-
-            if (!activateOnDock) return;
-
-            if (Intent.ACTION_DOCK_EVENT.equals(intent.getAction())) {
-                Bundle extras = intent.getExtras();
-                int state = extras
-                        .getInt(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_UNDOCKED);
-                if (state == Intent.EXTRA_DOCK_STATE_DESK
-                        || state == Intent.EXTRA_DOCK_STATE_LE_DESK
-                        || state == Intent.EXTRA_DOCK_STATE_HE_DESK) {
-                    launchDream(context);
-                }
-            }
-        }
-    }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
index 1068267..e3f2ca4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -917,6 +917,7 @@
         String wifiLabel = "";
         String mobileLabel = "";
         int N;
+        final boolean emergencyOnly = (mServiceState != null && mServiceState.isEmergencyOnly());
 
         if (!mHasMobileDataFeature) {
             mDataSignalIconId = mPhoneSignalIconId = 0;
@@ -932,10 +933,12 @@
 
             if (mDataConnected) {
                 mobileLabel = mNetworkName;
-            } else if (mConnected) {
-                if (hasService()) {
+            } else if (mConnected || emergencyOnly) {
+                if (hasService() || emergencyOnly) {
+                    // The isEmergencyOnly test covers the case of a phone with no SIM
                     mobileLabel = mNetworkName;
                 } else {
+                    // Tablets, basically
                     mobileLabel = "";
                 }
             } else {
diff --git a/test-runner/src/android/test/MoreAsserts.java b/test-runner/src/android/test/MoreAsserts.java
index 9e0d018..83cc420 100644
--- a/test-runner/src/android/test/MoreAsserts.java
+++ b/test-runner/src/android/test/MoreAsserts.java
@@ -158,7 +158,7 @@
      * Asserts that array {@code actual} is the same size and every element
      * is the same as those in array {@code expected}. Note that this uses
      * {@code equals()} instead of {@code ==} to compare the objects.
-     * {@code null} will be considered equal to {code null} (unlike SQL).
+     * {@code null} will be considered equal to {@code null} (unlike SQL).
      * On failure, message indicates first specific element mismatch.
      */
     public static void assertEquals(
diff --git a/test-runner/src/android/test/ServiceTestCase.java b/test-runner/src/android/test/ServiceTestCase.java
index 06c1c5b..eaace27 100644
--- a/test-runner/src/android/test/ServiceTestCase.java
+++ b/test-runner/src/android/test/ServiceTestCase.java
@@ -91,7 +91,7 @@
  *      {@link #setApplication setApplication()}.  You must do this <em>before</em> calling
  *      startService() or bindService().  The test framework provides a
  *      number of alternatives for Context, including
- *      {link android.test.mock.MockContext MockContext},
+ *      {@link android.test.mock.MockContext MockContext},
  *      {@link android.test.RenamingDelegatingContext RenamingDelegatingContext},
  *      {@link android.content.ContextWrapper ContextWrapper}, and
  *      {@link android.test.IsolatedContext}.
diff --git a/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java b/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java
index 919e2b3..4ec86b186 100644
--- a/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java
+++ b/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java
@@ -69,7 +69,7 @@
     /**
      * Helper method that fetches all the network stats available and reports it
      * to instrumentation out.
-     * @param template {link {@link NetworkTemplate} to match.
+     * @param template {@link NetworkTemplate} to match.
      */
     private void fetchStats(NetworkTemplate template) {
         INetworkStatsSession session = null;
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 7f8f9ce..7e47c99 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -1590,7 +1590,7 @@
 
     /**
      * Record the detailed state of a network.
-     * @param state the new @{code DetailedState}
+     * @param state the new {@code DetailedState}
      */
     private void setNetworkDetailedState(NetworkInfo.DetailedState state) {
         if (DBG) {