Merge "Update mapping between RAF and Network Type." into lmp-mr1-dev
diff --git a/api/current.txt b/api/current.txt
index 725c27d..1f86b03 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -25657,10 +25657,6 @@
   public static final class Telephony.Mms.Intents {
     field public static final java.lang.String CONTENT_CHANGED_ACTION = "android.intent.action.CONTENT_CHANGED";
     field public static final java.lang.String DELETED_CONTENTS = "deleted_contents";
-    field public static final java.lang.String EXTRA_MMS_CONTENT_URI = "android.provider.Telephony.extra.MMS_CONTENT_URI";
-    field public static final java.lang.String EXTRA_MMS_LOCATION_URL = "android.provider.Telephony.extra.MMS_LOCATION_URL";
-    field public static final java.lang.String MMS_DOWNLOAD_ACTION = "android.provider.Telephony.MMS_DOWNLOAD";
-    field public static final java.lang.String MMS_SEND_ACTION = "android.provider.Telephony.MMS_SEND";
   }
 
   public static final class Telephony.Mms.Outbox implements android.provider.Telephony.BaseMmsColumns {
@@ -25765,10 +25761,8 @@
     field public static final java.lang.String SMS_CB_RECEIVED_ACTION = "android.provider.Telephony.SMS_CB_RECEIVED";
     field public static final java.lang.String SMS_DELIVER_ACTION = "android.provider.Telephony.SMS_DELIVER";
     field public static final java.lang.String SMS_EMERGENCY_CB_RECEIVED_ACTION = "android.provider.Telephony.SMS_EMERGENCY_CB_RECEIVED";
-    field public static final java.lang.String SMS_FILTER_ACTION = "android.provider.Telephony.SMS_FILTER";
     field public static final java.lang.String SMS_RECEIVED_ACTION = "android.provider.Telephony.SMS_RECEIVED";
     field public static final java.lang.String SMS_REJECTED_ACTION = "android.provider.Telephony.SMS_REJECTED";
-    field public static final java.lang.String SMS_SEND_ACTION = "android.provider.Telephony.SMS_SEND";
     field public static final java.lang.String SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION = "android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED";
     field public static final java.lang.String WAP_PUSH_DELIVER_ACTION = "android.provider.Telephony.WAP_PUSH_DELIVER";
     field public static final java.lang.String WAP_PUSH_RECEIVED_ACTION = "android.provider.Telephony.WAP_PUSH_RECEIVED";
@@ -28511,9 +28505,6 @@
     method public void sendMultimediaMessage(android.content.Context, android.net.Uri, java.lang.String, android.os.Bundle, android.app.PendingIntent);
     method public void sendMultipartTextMessage(java.lang.String, java.lang.String, java.util.ArrayList<java.lang.String>, java.util.ArrayList<android.app.PendingIntent>, java.util.ArrayList<android.app.PendingIntent>);
     method public void sendTextMessage(java.lang.String, java.lang.String, java.lang.String, android.app.PendingIntent, android.app.PendingIntent);
-    method public void updateMmsDownloadStatus(android.content.Context, int, int, android.net.Uri);
-    method public void updateMmsSendStatus(android.content.Context, int, byte[], int, android.net.Uri);
-    method public void updateSmsSendStatus(int, boolean);
     field public static final java.lang.String EXTRA_MMS_DATA = "android.telephony.extra.MMS_DATA";
     field public static final java.lang.String EXTRA_MMS_HTTP_STATUS = "android.telephony.extra.MMS_HTTP_STATUS";
     field public static final java.lang.String MMS_CONFIG_ALIAS_ENABLED = "aliasEnabled";
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
index 3d390bf..39ae65c 100644
--- a/core/java/android/app/ActivityOptions.java
+++ b/core/java/android/app/ActivityOptions.java
@@ -384,6 +384,8 @@
      * of the animation.
      * @param startX The x starting location of the bitmap, relative to <var>source</var>.
      * @param startY The y starting location of the bitmap, relative to <var>source</var>.
+     * @param handler If <var>listener</var> is non-null this must be a valid
+     * Handler on which to dispatch the callback; otherwise it should be null.
      * @param listener Optional OnAnimationStartedListener to find out when the
      * requested animation has started running.  If for some reason the animation
      * is not executed, the callback will happen immediately.
@@ -393,9 +395,9 @@
      */
     public static ActivityOptions makeThumbnailAspectScaleUpAnimation(View source,
             Bitmap thumbnail, int startX, int startY, int targetWidth, int targetHeight,
-            OnAnimationStartedListener listener) {
+            Handler handler, OnAnimationStartedListener listener) {
         return makeAspectScaledThumbnailAnimation(source, thumbnail, startX, startY,
-                targetWidth, targetHeight, listener, true);
+                targetWidth, targetHeight, handler, listener, true);
     }
 
     /**
@@ -408,6 +410,8 @@
      * of the animation.
      * @param startX The x end location of the bitmap, relative to <var>source</var>.
      * @param startY The y end location of the bitmap, relative to <var>source</var>.
+     * @param handler If <var>listener</var> is non-null this must be a valid
+     * Handler on which to dispatch the callback; otherwise it should be null.
      * @param listener Optional OnAnimationStartedListener to find out when the
      * requested animation has started running.  If for some reason the animation
      * is not executed, the callback will happen immediately.
@@ -417,14 +421,14 @@
      */
     public static ActivityOptions makeThumbnailAspectScaleDownAnimation(View source,
             Bitmap thumbnail, int startX, int startY, int targetWidth, int targetHeight,
-            OnAnimationStartedListener listener) {
+            Handler handler, OnAnimationStartedListener listener) {
         return makeAspectScaledThumbnailAnimation(source, thumbnail, startX, startY,
-                targetWidth, targetHeight, listener, false);
+                targetWidth, targetHeight, handler, listener, false);
     }
 
     private static ActivityOptions makeAspectScaledThumbnailAnimation(View source, Bitmap thumbnail,
             int startX, int startY, int targetWidth, int targetHeight,
-            OnAnimationStartedListener listener, boolean scaleUp) {
+            Handler handler, OnAnimationStartedListener listener, boolean scaleUp) {
         ActivityOptions opts = new ActivityOptions();
         opts.mPackageName = source.getContext().getPackageName();
         opts.mAnimationType = scaleUp ? ANIM_THUMBNAIL_ASPECT_SCALE_UP :
@@ -436,7 +440,7 @@
         opts.mStartY = pts[1] + startY;
         opts.mWidth = targetWidth;
         opts.mHeight = targetHeight;
-        opts.setOnAnimationStartedListener(source.getHandler(), listener);
+        opts.setOnAnimationStartedListener(handler, listener);
         return opts;
     }
 
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 9e8a793..80b57b7 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -3055,6 +3055,11 @@
          * Apply any necessary background to smallIcons being used in the largeIcon spot.
          */
         private void processSmallIconAsLarge(int largeIconId, RemoteViews contentView) {
+            if (!isLegacy()) {
+                contentView.setDrawableParameters(R.id.icon, false, -1,
+                        0xFFFFFFFF,
+                        PorterDuff.Mode.SRC_ATOP, -1);
+            }
             if (!isLegacy() || mColorUtil.isGrayscaleIcon(mContext, largeIconId)) {
                 applyLargeIconBackground(contentView);
             }
@@ -3102,11 +3107,12 @@
          */
         private void processSmallRightIcon(int smallIconDrawableId,
                 RemoteViews contentView) {
-            if (!isLegacy() || mColorUtil.isGrayscaleIcon(mContext, smallIconDrawableId)) {
+            if (!isLegacy()) {
                 contentView.setDrawableParameters(R.id.right_icon, false, -1,
                         0xFFFFFFFF,
                         PorterDuff.Mode.SRC_ATOP, -1);
-
+            }
+            if (!isLegacy() || mColorUtil.isGrayscaleIcon(mContext, smallIconDrawableId)) {
                 contentView.setInt(R.id.right_icon,
                         "setBackgroundResource",
                         R.drawable.notification_icon_legacy_bg);
@@ -3771,8 +3777,24 @@
         }
 
         private RemoteViews makeBigContentView() {
+
+            // Replace mLargeIcon with mBigLargeIcon if mBigLargeIconSet
+            // This covers the following cases:
+            //   1. mBigLargeIconSet -> mBigLargeIcon (null or non-null) applies, overrides
+            //          mLargeIcon
+            //   2. !mBigLargeIconSet -> mLargeIcon applies
+            Bitmap oldLargeIcon = null;
+            if (mBigLargeIconSet) {
+                oldLargeIcon = mBuilder.mLargeIcon;
+                mBuilder.mLargeIcon = mBigLargeIcon;
+            }
+
             RemoteViews contentView = getStandardView(mBuilder.getBigPictureLayoutResource());
 
+            if (mBigLargeIconSet) {
+                mBuilder.mLargeIcon = oldLargeIcon;
+            }
+
             contentView.setImageViewBitmap(R.id.big_picture, mPicture);
 
             applyTopPadding(contentView);
@@ -3803,6 +3825,7 @@
             super.restoreFromExtras(extras);
 
             if (extras.containsKey(EXTRA_LARGE_ICON_BIG)) {
+                mBigLargeIconSet = true;
                 mBigLargeIcon = extras.getParcelable(EXTRA_LARGE_ICON_BIG);
             }
             mPicture = extras.getParcelable(EXTRA_PICTURE);
@@ -4098,7 +4121,7 @@
      *
      * Unlike the other styles provided here, MediaStyle can also modify the standard-size
      * {@link Notification#contentView}; by providing action indices to
-     * {@link #setShowActionsInCompactView(int...)} you can promote up to 2 actions to be displayed
+     * {@link #setShowActionsInCompactView(int...)} you can promote up to 3 actions to be displayed
      * in the standard view alongside the usual content.
      *
      * Notifications created with MediaStyle will have their category set to
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index ead89b3..1211260 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -2797,6 +2797,8 @@
     /**
      * Called by the profile owner of a managed profile so that some intents sent in the managed
      * profile can also be resolved in the parent, or vice versa.
+     * Only activity intents are supported.
+     *
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
      * @param filter The {@link IntentFilter} the intent has to match to be also resolved in the
      * other profile
diff --git a/core/java/android/appwidget/AppWidgetHost.java b/core/java/android/appwidget/AppWidgetHost.java
index 24c6793..8e86824 100644
--- a/core/java/android/appwidget/AppWidgetHost.java
+++ b/core/java/android/appwidget/AppWidgetHost.java
@@ -57,7 +57,7 @@
     static IAppWidgetService sService;
     private DisplayMetrics mDisplayMetrics;
 
-    Context mContext;
+    private String mContextOpPackageName;
     Handler mHandler;
     int mHostId;
     Callbacks mCallbacks = new Callbacks();
@@ -128,7 +128,7 @@
      * @hide
      */
     public AppWidgetHost(Context context, int hostId, OnClickHandler handler, Looper looper) {
-        mContext = context;
+        mContextOpPackageName = context.getOpPackageName();
         mHostId = hostId;
         mOnClickHandler = handler;
         mHandler = new UpdateHandler(looper);
@@ -154,7 +154,7 @@
         int[] updatedIds;
         ArrayList<RemoteViews> updatedViews = new ArrayList<RemoteViews>();
         try {
-            updatedIds = sService.startListening(mCallbacks, mContext.getOpPackageName(), mHostId,
+            updatedIds = sService.startListening(mCallbacks, mContextOpPackageName, mHostId,
                     updatedViews);
         }
         catch (RemoteException e) {
@@ -173,7 +173,7 @@
      */
     public void stopListening() {
         try {
-            sService.stopListening(mContext.getOpPackageName(), mHostId);
+            sService.stopListening(mContextOpPackageName, mHostId);
         }
         catch (RemoteException e) {
             throw new RuntimeException("system server dead?", e);
@@ -191,7 +191,7 @@
      */
     public int allocateAppWidgetId() {
         try {
-            return sService.allocateAppWidgetId(mContext.getOpPackageName(), mHostId);
+            return sService.allocateAppWidgetId(mContextOpPackageName, mHostId);
         }
         catch (RemoteException e) {
             throw new RuntimeException("system server dead?", e);
@@ -221,7 +221,7 @@
             int appWidgetId, int intentFlags, int requestCode, @Nullable Bundle options) {
         try {
             IntentSender intentSender = sService.createAppWidgetConfigIntentSender(
-                    mContext.getOpPackageName(), appWidgetId, intentFlags);
+                    mContextOpPackageName, appWidgetId, intentFlags);
             if (intentSender != null) {
                 activity.startIntentSenderForResult(intentSender, requestCode, null, 0, 0, 0,
                         options);
@@ -245,7 +245,7 @@
             if (sService == null) {
                 bindService();
             }
-            return sService.getAppWidgetIdsForHost(mContext.getOpPackageName(), mHostId);
+            return sService.getAppWidgetIdsForHost(mContextOpPackageName, mHostId);
         } catch (RemoteException e) {
             throw new RuntimeException("system server dead?", e);
         }
@@ -262,7 +262,7 @@
         synchronized (mViews) {
             mViews.remove(appWidgetId);
             try {
-                sService.deleteAppWidgetId(mContext.getOpPackageName(), appWidgetId);
+                sService.deleteAppWidgetId(mContextOpPackageName, appWidgetId);
             }
             catch (RemoteException e) {
                 throw new RuntimeException("system server dead?", e);
@@ -280,7 +280,7 @@
      */
     public void deleteHost() {
         try {
-            sService.deleteHost(mContext.getOpPackageName(), mHostId);
+            sService.deleteHost(mContextOpPackageName, mHostId);
         }
         catch (RemoteException e) {
             throw new RuntimeException("system server dead?", e);
@@ -310,7 +310,7 @@
      */
     public final AppWidgetHostView createView(Context context, int appWidgetId,
             AppWidgetProviderInfo appWidget) {
-        AppWidgetHostView view = onCreateView(mContext, appWidgetId, appWidget);
+        AppWidgetHostView view = onCreateView(context, appWidgetId, appWidget);
         view.setOnClickHandler(mOnClickHandler);
         view.setAppWidget(appWidgetId, appWidget);
         synchronized (mViews) {
@@ -318,7 +318,7 @@
         }
         RemoteViews views;
         try {
-            views = sService.getAppWidgetViews(mContext.getOpPackageName(), appWidgetId);
+            views = sService.getAppWidgetViews(mContextOpPackageName, appWidgetId);
         } catch (RemoteException e) {
             throw new RuntimeException("system server dead?", e);
         }
diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java
index 546a50e..25d9aa9 100644
--- a/core/java/android/bluetooth/BluetoothHeadset.java
+++ b/core/java/android/bluetooth/BluetoothHeadset.java
@@ -229,7 +229,6 @@
     private ServiceListener mServiceListener;
     private IBluetoothHeadset mService;
     private BluetoothAdapter mAdapter;
-    private boolean mIsClosed;
 
     final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
             new IBluetoothStateChangeCallback.Stub() {
@@ -260,7 +259,6 @@
         mContext = context;
         mServiceListener = l;
         mAdapter = BluetoothAdapter.getDefaultAdapter();
-        mIsClosed = false;
 
         IBluetoothManager mgr = mAdapter.getBluetoothManager();
         if (mgr != null) {
@@ -314,7 +312,7 @@
                 Log.e(TAG,"",e);
             }
         }
-        mIsClosed = true;
+        mServiceListener = null;
         doUnbind();
     }
 
@@ -983,9 +981,6 @@
                     if (mServiceListener != null) {
                         mServiceListener.onServiceDisconnected(BluetoothProfile.HEADSET);
                     }
-                    if (mIsClosed){
-                        mServiceListener = null;
-                    }
                     break;
                 }
             }
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index 360f308..0cff4c0 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -286,10 +286,12 @@
             final String original = setCallingPackage(callingPkg);
             try {
                 ContentProviderResult[] results = ContentProvider.this.applyBatch(operations);
-                for (int i = 0; i < results.length ; i++) {
-                    if (userIds[i] != UserHandle.USER_CURRENT) {
-                        // Adding the userId to the uri.
-                        results[i] = new ContentProviderResult(results[i], userIds[i]);
+                if (results != null) {
+                    for (int i = 0; i < results.length ; i++) {
+                        if (userIds[i] != UserHandle.USER_CURRENT) {
+                            // Adding the userId to the uri.
+                            results[i] = new ContentProviderResult(results[i], userIds[i]);
+                        }
                     }
                 }
                 return results;
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 555f64c..838686a 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -5924,6 +5924,18 @@
        public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay";
 
        /**
+        * Timeout for ephemeral networks when all known BSSIDs go out of range. We will disconnect
+        * from an ephemeral network if there is no BSSID for that network with a non-null score that
+        * has been seen in this time period.
+        *
+        * If this is less than or equal to zero, we use a more conservative behavior and only check
+        * for a non-null score from the currently connected or target BSSID.
+        * @hide
+        */
+       public static final String WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS =
+               "wifi_ephemeral_out_of_range_timeout_ms";
+
+       /**
         * The number of milliseconds to delay when checking for data stalls during
         * non-aggressive detection. (screen is turned off.)
         * @hide
diff --git a/core/java/android/text/util/Linkify.java b/core/java/android/text/util/Linkify.java
index 14be269..c1341e1 100644
--- a/core/java/android/text/util/Linkify.java
+++ b/core/java/android/text/util/Linkify.java
@@ -402,7 +402,7 @@
         }
 
         boolean hasPrefix = false;
-
+        
         for (int i = 0; i < prefixes.length; i++) {
             if (url.regionMatches(true, 0, prefixes[i], 0,
                                   prefixes[i].length())) {
@@ -450,7 +450,7 @@
     private static final void gatherTelLinks(ArrayList<LinkSpec> links, Spannable s) {
         PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
         Iterable<PhoneNumberMatch> matches = phoneUtil.findNumbers(s.toString(),
-                Locale.getDefault().getCountry(), Leniency.VALID, Long.MAX_VALUE);
+                Locale.getDefault().getCountry(), Leniency.POSSIBLE, Long.MAX_VALUE);
         for (PhoneNumberMatch match : matches) {
             LinkSpec spec = new LinkSpec();
             spec.url = "tel:" + PhoneNumberUtils.normalizeNumber(match.rawString());
diff --git a/core/java/com/android/internal/widget/ResolverDrawerLayout.java b/core/java/com/android/internal/widget/ResolverDrawerLayout.java
index 25b4945..ed7af2f 100644
--- a/core/java/com/android/internal/widget/ResolverDrawerLayout.java
+++ b/core/java/com/android/internal/widget/ResolverDrawerLayout.java
@@ -217,8 +217,9 @@
                 mInitialTouchX = x;
                 mInitialTouchY = mLastTouchY = y;
                 mActivePointerId = ev.getPointerId(0);
-                mIsDragging = findChildUnder(mInitialTouchX, mInitialTouchY) != null;
-                handled = (!mIsDragging && mOnDismissedListener != null) || mCollapsibleHeight > 0;
+                final boolean hitView = findChildUnder(mInitialTouchX, mInitialTouchY) != null;
+                handled = (!hitView && mOnDismissedListener != null) || mCollapsibleHeight > 0;
+                mIsDragging = hitView && handled;
                 abortAnimation();
             }
             break;
diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml
index 84cbf78..1670857 100644
--- a/core/res/res/values-da/strings.xml
+++ b/core/res/res/values-da/strings.xml
@@ -47,7 +47,7 @@
     <string name="defaultVoiceMailAlphaTag" msgid="2660020990097733077">"Telefonsvarer"</string>
     <string name="defaultMsisdnAlphaTag" msgid="2850889754919584674">"MSISDN1"</string>
     <string name="mmiError" msgid="5154499457739052907">"Forbindelsesproblemer eller ugyldigt MMI-nummer."</string>
-    <string name="mmiFdnError" msgid="5224398216385316471">"Du kan kun foretage handlinger med faste opkaldsnumre."</string>
+    <string name="mmiFdnError" msgid="5224398216385316471">"Du kan kun foretage handlinger med dine numre til begrænset opkald."</string>
     <string name="serviceEnabled" msgid="8147278346414714315">"Tjenesten blev aktiveret."</string>
     <string name="serviceEnabledFor" msgid="6856228140453471041">"Tjenesten blev aktiveret for:"</string>
     <string name="serviceDisabled" msgid="1937553226592516411">"Tjenesten er deaktiveret."</string>
diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml
index 031b4d9..fd2b6cc 100644
--- a/core/res/res/values-fr/strings.xml
+++ b/core/res/res/values-fr/strings.xml
@@ -1287,7 +1287,7 @@
     <string name="force_close" msgid="8346072094521265605">"OK"</string>
     <string name="report" msgid="4060218260984795706">"Rapport"</string>
     <string name="wait" msgid="7147118217226317732">"Attendre"</string>
-    <string name="webpage_unresponsive" msgid="3272758351138122503">"La page ne répond pas.\n \nVoulez-vous la fermer ?"</string>
+    <string name="webpage_unresponsive" msgid="3272758351138122503">"La page ne répond pas.\n \nVoulez-vous quitter ?"</string>
     <string name="launch_warning_title" msgid="1547997780506713581">"Application redirigée"</string>
     <string name="launch_warning_replace" msgid="6202498949970281412">"<xliff:g id="APP_NAME">%1$s</xliff:g> est maintenant lancée."</string>
     <string name="launch_warning_original" msgid="188102023021668683">"Application lancée initialement : <xliff:g id="APP_NAME">%1$s</xliff:g>."</string>
diff --git a/core/res/res/values-mcc204-mnc04/config.xml b/core/res/res/values-mcc204-mnc04/config.xml
index dbda6af..fb639ca 100755
--- a/core/res/res/values-mcc204-mnc04/config.xml
+++ b/core/res/res/values-mcc204-mnc04/config.xml
@@ -44,23 +44,12 @@
         <item>false</item>
     </string-array>
 
-    <!-- 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",
          Or string format of ApnSettingV3.
          note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
     <string-array translatable="false" name="config_tether_apndata">
-        <item>Vodafone NL,live.vodafone.com,,,vodafone,vodafone,,,,,204,04,,DUN</item>
         <item>[ApnSettingV3]SaskTel Tethering,inet.stm.sk.ca,,,,,,,,,204,04,,DUN,,,true,0,,,,,,,gid,5A</item>
     </string-array>
 
diff --git a/core/res/res/values-mcc208-mnc01/config.xml b/core/res/res/values-mcc208-mnc01/config.xml
index 7e44624..c56da24 100644
--- a/core/res/res/values-mcc208-mnc01/config.xml
+++ b/core/res/res/values-mcc208-mnc01/config.xml
@@ -20,15 +20,6 @@
 <!-- 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:
diff --git a/core/res/res/values-mcc208-mnc10/config.xml b/core/res/res/values-mcc208-mnc10/config.xml
index 10e8dcc..a32f266 100644
--- a/core/res/res/values-mcc208-mnc10/config.xml
+++ b/core/res/res/values-mcc208-mnc10/config.xml
@@ -21,14 +21,6 @@
      for different hardware and product builds. -->
 <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>
-    </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",
diff --git a/core/res/res/values-mcc214-mnc03/config.xml b/core/res/res/values-mcc214-mnc03/config.xml
index 2599707..aa16468 100644
--- a/core/res/res/values-mcc214-mnc03/config.xml
+++ b/core/res/res/values-mcc214-mnc03/config.xml
@@ -20,15 +20,6 @@
 <!-- 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:
diff --git a/core/res/res/values-mcc214-mnc07/config.xml b/core/res/res/values-mcc214-mnc07/config.xml
index b8328df..91571a5 100644
--- a/core/res/res/values-mcc214-mnc07/config.xml
+++ b/core/res/res/values-mcc214-mnc07/config.xml
@@ -21,16 +21,6 @@
      for different hardware and product builds. -->
 <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",
diff --git a/core/res/res/values-mcc222-mnc01/config.xml b/core/res/res/values-mcc222-mnc01/config.xml
index 0d61c6e..4b1981f 100644
--- a/core/res/res/values-mcc222-mnc01/config.xml
+++ b/core/res/res/values-mcc222-mnc01/config.xml
@@ -20,15 +20,6 @@
 <!-- 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:
diff --git a/core/res/res/values-mcc234-mnc33/config.xml b/core/res/res/values-mcc234-mnc33/config.xml
index e9d3bdb..4637519 100644
--- a/core/res/res/values-mcc234-mnc33/config.xml
+++ b/core/res/res/values-mcc234-mnc33/config.xml
@@ -30,16 +30,6 @@
         <item>23486</item>
     </string-array>
 
-    <!-- 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",
diff --git a/core/res/res/values-mcc302-mnc220/config.xml b/core/res/res/values-mcc302-mnc220/config.xml
index 3872922..b70e1b4 100644
--- a/core/res/res/values-mcc302-mnc220/config.xml
+++ b/core/res/res/values-mcc302-mnc220/config.xml
@@ -31,16 +31,6 @@
 
     <integer name="config_mobile_mtu">1410</integer>
 
-    <!-- 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",
diff --git a/core/res/res/values-mcc302-mnc221/config.xml b/core/res/res/values-mcc302-mnc221/config.xml
index 3a453b7..ffc9d6c 100644
--- a/core/res/res/values-mcc302-mnc221/config.xml
+++ b/core/res/res/values-mcc302-mnc221/config.xml
@@ -21,16 +21,6 @@
      for different hardware and product builds. -->
 <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",
diff --git a/core/res/res/values-mcc302-mnc370/config.xml b/core/res/res/values-mcc302-mnc370/config.xml
index 13f19f7..5e7e8bc 100644
--- a/core/res/res/values-mcc302-mnc370/config.xml
+++ b/core/res/res/values-mcc302-mnc370/config.xml
@@ -20,15 +20,6 @@
 <!-- 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:
diff --git a/core/res/res/values-mcc302-mnc720/config.xml b/core/res/res/values-mcc302-mnc720/config.xml
index c20ca12..a83107a 100644
--- a/core/res/res/values-mcc302-mnc720/config.xml
+++ b/core/res/res/values-mcc302-mnc720/config.xml
@@ -20,15 +20,6 @@
 <!-- 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:
diff --git a/core/res/res/values-mcc454-mnc10/config.xml b/core/res/res/values-mcc454-mnc10/config.xml
index e7622a0..79a9a7e 100644
--- a/core/res/res/values-mcc454-mnc10/config.xml
+++ b/core/res/res/values-mcc454-mnc10/config.xml
@@ -21,16 +21,6 @@
      for different hardware and product builds. -->
 <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",
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 72ff8eb..0376a5d 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -293,6 +293,7 @@
             }
 
         See src/com/android/settings/TetherSettings.java for more details.
+        For ui-less/periodic recheck support see config_mobile_hotspot_provision_app_no_ui
         -->
     <!-- The first element is the package name and the second element is the class name
          of the provisioning app -->
@@ -303,8 +304,42 @@
     -->
     </string-array>
 
+    <!-- If the mobile hotspot feature requires provisioning, an action can be provided
+         that will be broadcast in non-ui cases for checking the provisioning status.
+
+         A second broadcast, action defined by config_mobile_hotspot_provision_response,
+         will be sent back to notify if provisioning succeeded or not.  The response will
+         match that of the activity in config_mobile_hotspot_provision_app, but instead
+         contained within the int extra "EntitlementResult".
+
+         Example Usage:
+         String provisionAction = getString(R.string.config_mobile_hotspot_provision_check);
+         sendBroadcast(new Intent(provisionAction));
+
+         public void onReceive(Context context, Intent intent) {
+             String provisionResponse =
+                    getString(R.string.config_mobile_hotspot_provision_response);
+             if (provisionResponse.equals(intent.getAction())
+                    && intent.getIntExtra("EntitlementResult") == Activity.RESULT_OK) {
+                 //Mobile hotspot provisioning successful
+             } else {
+                 //Mobile hotspot provisioning failed
+             }
+         }
+        -->
+    <string translatable="false" name="config_mobile_hotspot_provision_app_no_ui"></string>
+    <!-- Sent in response to a provisioning check. The caller must hold the
+         permission android.permission.CONNECTIVITY_INTERNAL for Settings to
+         receive this response.
+
+         See config_mobile_hotspot_provision_response
+         -->
+    <string translatable="false" name="config_mobile_hotspot_provision_response"></string>
+    <!-- Number of hours between each background provisioning call -->
+    <integer translatable="false" name="config_mobile_hotspot_provision_check_period">24</integer>
+
     <!-- Activity name to enable wifi tethering after provisioning app succeeds -->
-    <string translatable="false" name="config_wifi_tether_enable">com.android.settings/.EnableWifiTether</string>
+    <string translatable="false" name="config_wifi_tether_enable">com.android.settings/.TetherService</string>
 
     <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
     <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 3dd783f..6661290 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1880,6 +1880,9 @@
 
   <!-- From Settings -->
   <java-symbol type="array" name="config_mobile_hotspot_provision_app" />
+  <java-symbol type="string" name="config_mobile_hotspot_provision_app_no_ui" />
+  <java-symbol type="string" name="config_mobile_hotspot_provision_response" />
+  <java-symbol type="integer" name="config_mobile_hotspot_provision_check_period" />
   <java-symbol type="string" name="config_wifi_tether_enable" />
   <java-symbol type="bool" name="config_intrusiveNotificationLed" />
   <java-symbol type="dimen" name="preference_fragment_padding_bottom" />
diff --git a/docs/html/design/patterns/notifications.jd b/docs/html/design/patterns/notifications.jd
index f5cd2a7..fdd435c 100644
--- a/docs/html/design/patterns/notifications.jd
+++ b/docs/html/design/patterns/notifications.jd
@@ -15,6 +15,14 @@
   </div>
 </a>
 
+<!-- video box -->
+<a class="notice-developers-video" href="https://www.youtube.com/watch?v=Uiq2kZ2JHVY">
+<div>
+    <h3>Video</h3>
+    <p>DevBytes: Notifications in the Android L Developer Preview</p>
+</div>
+</a>
+
 <style>
   .col-5, .col-6, .col-7 {
     margin-left:0px;
diff --git a/docs/html/distribute/engage/engage_toc.cs b/docs/html/distribute/engage/engage_toc.cs
index 596051a..eb176f9 100644
--- a/docs/html/distribute/engage/engage_toc.cs
+++ b/docs/html/distribute/engage/engage_toc.cs
@@ -1,61 +1,61 @@
 <ul id="nav">
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
         var:toroot?>distribute/engage/widgets.html">
         <span class="en">Build Useful Widgets</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
         var:toroot?>distribute/engage/notifications.html">
         <span class="en">Use Rich Notifications</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
         var:toroot?>distribute/engage/gcm.html">
         <span class="en">Integrate GCM</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
         var:toroot?>distribute/engage/easy-signin.html">
         <span class="en">Make Signing In Easy</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
         var:toroot?>distribute/engage/deep-linking.html">
         <span class="en">Deep Link to Bring Users Back</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
         var:toroot?>distribute/engage/game-services.html">
         <span class="en">Encourage Competition</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
         var:toroot?>distribute/engage/analytics.html">
         <span class="en">Understand User Behavior</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
         var:toroot?>distribute/engage/app-updates.html">
         <span class="en">Update Regularly</span></a>
     </div>
   </li>
 
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
         var:toroot?>distribute/engage/community.html">
         <span class="en">Engage Your Community</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
         var:toroot?>distribute/engage/video.html">
         <span class="en">Delight with Videos</span></a>
     </div>
diff --git a/docs/html/distribute/essentials/essentials_toc.cs b/docs/html/distribute/essentials/essentials_toc.cs
index 0369d4d..fe3fc87 100644
--- a/docs/html/distribute/essentials/essentials_toc.cs
+++ b/docs/html/distribute/essentials/essentials_toc.cs
@@ -1,47 +1,47 @@
 <ul id="nav">
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/quality/core.html" zh-cn-lang="应用的核心质量">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/quality/core.html" zh-cn-lang="应用的核心质量">
             <span class="en">Core App Quality</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/quality/tablets.html" zh-cn-lang="平板电脑应用的质量">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/quality/tablets.html" zh-cn-lang="平板电脑应用的质量">
             <span class="en">Tablet App Quality</span>
           </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/quality/tv.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/quality/tv.html">
             <span class="en">TV App Quality</span>
           </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/quality/wear.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/quality/wear.html">
             <span class="en">Wear App Quality</span>
           </a>
     </div>
   </li>
     <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/quality/auto.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/quality/auto.html">
             <span class="en">Auto App Quality</span>
           </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/optimizing-your-app.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/optimizing-your-app.html">
           <span class="en">Optimize Your App</span>
         </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/best-practices/apps.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/best-practices/apps.html">
           <span class="en">App Best Practices</span>
         </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/best-practices/games.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/essentials/best-practices/games.html">
           <span class="en">Game Best Practices</span>
         </a>
     </div>
diff --git a/docs/html/distribute/essentials/quality/wear.jd b/docs/html/distribute/essentials/quality/wear.jd
index a233241..fc1c73f 100644
--- a/docs/html/distribute/essentials/quality/wear.jd
+++ b/docs/html/distribute/essentials/quality/wear.jd
@@ -82,7 +82,7 @@
 </tr>
 
 <tr>
-  <td rowspan="1" id="general">
+  <td rowspan="3" id="general">
    General
   </td>
 
@@ -99,6 +99,28 @@
 </tr>
 
 <tr>
+ <td id="WR-VF">
+    WR-VF
+  </td>
+  <td>
+    <p style="margin-bottom:.5em;">
+      App has Wear functionality that is visible to the user.
+    </p>
+  </td>
+</tr>
+
+<tr>
+ <td id="WR-BF">
+    WR-BF
+  </td>
+  <td>
+    <p style="margin-bottom:.5em;">
+      Wear functionality works as expected or as described in the app's Google Play Store listing.
+    </p>
+  </td>
+</tr>
+
+<tr>
   <td rowspan="1" id="packaging">
    Packaging
   </td>
@@ -115,7 +137,6 @@
   </td>
 </tr>
 
-
 <tr>
   <td rowspan="3" id="functional-notifications">
     Notifications
diff --git a/docs/html/distribute/googleplay/googleplay_toc.cs b/docs/html/distribute/googleplay/googleplay_toc.cs
index 92475ff..3f4dbac 100644
--- a/docs/html/distribute/googleplay/googleplay_toc.cs
+++ b/docs/html/distribute/googleplay/googleplay_toc.cs
@@ -1,36 +1,36 @@
 <ul id="nav">
 
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/about.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/about.html">
             <span class="en">The Google Play Opportunity</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/start.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/start.html">
             <span class="en">Get Started with Publishing</span>
           </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/developer-console.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/developer-console.html">
           <span class="en">Developer Console</span>
         </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/guide.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/guide.html">
           <span class="en">Finding Success on Google Play</span>
         </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/tv.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/tv.html">
           <span class="en">Distributing to <span style="white-space:nowrap">Android TV</span></span>
         </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/wear.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/wear.html">
           <span class="en">Distributing to <span style="white-space:nowrap">Android Wear</span></span>
         </a>
     </div>
diff --git a/docs/html/distribute/monetize/monetize_toc.cs b/docs/html/distribute/monetize/monetize_toc.cs
index aeb6cf8..8211689 100644
--- a/docs/html/distribute/monetize/monetize_toc.cs
+++ b/docs/html/distribute/monetize/monetize_toc.cs
@@ -1,35 +1,35 @@
 <ul id="nav">
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/monetize/premium.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/monetize/premium.html">
             <span class="en">Premium</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/monetize/freemium.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/monetize/freemium.html">
             <span class="en">Freemium</span>
           </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/monetize/subscriptions.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/monetize/subscriptions.html">
           <span class="en">Subscriptions</span>
         </a
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/monetize/ecommerce.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/monetize/ecommerce.html">
           <span class="en">E-commerce</span>
         </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/monetize/ads.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/monetize/ads.html">
           <span class="en">Ads</span>
         </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/monetize/payments.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/monetize/payments.html">
           <span class="en">Purchasing</span>
         </a>
     </div>
diff --git a/docs/html/distribute/stories/stories_toc.cs b/docs/html/distribute/stories/stories_toc.cs
index 944dabe..54b7639 100644
--- a/docs/html/distribute/stories/stories_toc.cs
+++ b/docs/html/distribute/stories/stories_toc.cs
@@ -1,22 +1,22 @@
 <ul id="nav">
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/stories/index.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/stories/index.html">
             <span class="en">Videos</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/stories/localization.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/stories/localization.html">
             <span class="en">Going Global</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/stories/games.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/stories/games.html">
             <span class="en">Games</span>
           </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/stories/tablets.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/stories/tablets.html">
           <span class="en">Tablets</span>
         </a>
     </div>
diff --git a/docs/html/distribute/users/users_toc.cs b/docs/html/distribute/users/users_toc.cs
index 1f173cb..edfa874 100644
--- a/docs/html/distribute/users/users_toc.cs
+++ b/docs/html/distribute/users/users_toc.cs
@@ -1,35 +1,35 @@
 <ul id="nav">
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/know-your-user.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/know-your-user.html">
             <span class="en">Know Your User</span></a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/your-listing.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/your-listing.html">
             <span class="en">Create a Great Listing</span>
           </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/build-buzz.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/build-buzz.html">
           <span class="en">Build Buzz</span>
         </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/build-community.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/build-community.html">
           <span class="en">Build Community</span>
         </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/expand-to-new-markets.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/expand-to-new-markets.html">
           <span class="en">Expand to New Markets</span>
         </a>
     </div>
   </li>
   <li class="nav-section">
-    <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/promote-with-ads.html">
+    <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/promote-with-ads.html">
           <span class="en">Promote with Ads</span>
         </a>
     </div>
diff --git a/docs/html/sdk/exploring.jd b/docs/html/sdk/exploring.jd
deleted file mode 100644
index b34c1cf..0000000
--- a/docs/html/sdk/exploring.jd
+++ /dev/null
@@ -1,10 +0,0 @@
-page.title=Exploring the SDK
-excludeFromSuggestions=true
-walkthru=1
-
-@jd:body
-
-
-
-
-
diff --git a/docs/html/sdk/index.jd b/docs/html/sdk/index.jd
index e56f3f5..5d73d72 100644
--- a/docs/html/sdk/index.jd
+++ b/docs/html/sdk/index.jd
@@ -1,48 +1,49 @@
 page.title=Download Android Studio and SDK Tools
-page.tags=download
+page.tags=sdk, android studio
 page.template=sdk
 header.hide=1
 page.metaDescription=Download the official Android IDE and developer tools to build apps for Android phones, tablets, wearables, TVs, and more.
 
-studio.version=1.0.0
+studio.version=1.0.1
 
-studio.linux_bundle_download=android-studio-ide-135.1629389-linux.zip
-studio.linux_bundle_bytes=243909934
-studio.linux_bundle_checksum=601a302f10cf8a22ba4216e0884a035bdfec38b3
+studio.linux_bundle_download=android-studio-ide-135.1641136-linux.zip
+studio.linux_bundle_bytes=243917559
+studio.linux_bundle_checksum=7c8f2d0cec21b98984cdba45ab5a25f26d67f23a
 
-studio.mac_bundle_download=android-studio-ide-135.1629389.dmg
-studio.mac_bundle_bytes=245757810
-studio.mac_bundle_checksum=0d9e0e230ece9f2e696b1b076c36ee1e73edcf3c
+studio.mac_bundle_download=android-studio-ide-1641136.dmg
+studio.mac_bundle_bytes=245729073
+studio.mac_bundle_checksum=49506ba2cf6b56be4f7d07e6a00c4ec3ba2249d5
 
-studio.win_bundle_exe_download=android-studio-bundle-135.1629389.exe
-studio.win_bundle_exe_bytes=868337656
+studio.win_bundle_exe_download=android-studio-bundle-135.1641136.exe
+studio.win_bundle_exe_bytes=868344232
 studio.win_bundle_exe_checksum=1931dbaeadb52f5e0a8ba6e2ae60d9df20b2076b
 
-studio.win_notools_exe_download=android-studio-ide-135.1629389.exe
-studio.win_notools_exe_bytes=262099808
-studio.win_notools_exe_checksum=bfc6e9397f72969bcb3db80c9abe3a205540c8ab
+studio.win_notools_exe_download=android-studio-ide-135.1641136.exe
+studio.win_notools_exe_bytes=260272840
+studio.win_notools_exe_checksum=464d1c5497ab3d1bdef441365791ab36c89cd5ae
 
-studio.win_bundle_download=android-studio-ide-135.1629389-windows.zip
-studio.win_bundle_bytes=246241434
-studio.win_bundle_checksum=6951e678a41b94b6172276727537db8590be7270
+studio.win_bundle_download=android-studio-ide-135.1641136-windows.zip
+studio.win_bundle_bytes=246249059
+studio.win_bundle_checksum=6d6856aca83f6ff747ca40b10f70edfbbcccd91c
 
 
 
-sdk.linux_download=android-sdk_r24-linux.tgz
-sdk.linux_bytes=141308131
-sdk.linux_checksum=3cc1fcec302a8478e240e42b94dd2de73b9d0cc9
+sdk.linux_download=android-sdk_r24.0.2-linux.tgz
+sdk.linux_bytes=140097024
+sdk.linux_checksum=b6fd75e8b06b0028c2427e6da7d8a09d8f956a86
 
-sdk.mac_download=android-sdk_r24-macosx.zip
-sdk.mac_bytes=88535806
-sdk.mac_checksum=89b256c82e6ab432881fa7d726bdd0541c656616
+sdk.mac_download=android-sdk_r24.0.2-macosx.zip
+sdk.mac_bytes=87262823
+sdk.mac_checksum=3ab5e0ab0db5e7c45de9da7ff525dee6cfa97455
 
-sdk.win_download=android-sdk_r24-windows.zip
-sdk.win_bytes=140738187
-sdk.win_checksum=8d20f800cbace1b92873ebba1e16ff134a2b062b
+sdk.win_download=android-sdk_r24.0.2-windows.zip
+sdk.win_bytes=139473113
+sdk.win_checksum=51269c8336f936fc9b9538f9b9ca236b78fb4e4b
 
-sdk.win_installer=installer_r24-windows.exe
-sdk.win_installer_bytes=92179689
-sdk.win_installer_checksum=71ec3d91a4239b44128bf43add888bc357776be9
+sdk.win_installer=installer_r24.0.2-windows.exe
+sdk.win_installer_bytes=91428280
+sdk.win_installer_checksum=edac14e1541e97d68821fa3a709b4ea8c659e676
+
 
 
 
@@ -89,7 +90,7 @@
     display:block;
     padding:0;
     white-space: nowrap;
-    text-indent: 10000px;
+    text-indent: -10000px;
     font-size:0px;
     background: url(../images/tools/studio-logo.png);
     background-image: -webkit-image-set(url(../images/tools/studio-logo.png) 1x, url(../images/tools/studio-logo_2x.png) 2x);
diff --git a/docs/html/sdk/installing/index.jd b/docs/html/sdk/installing/index.jd
index 14d274f0..9a02382 100644
--- a/docs/html/sdk/installing/index.jd
+++ b/docs/html/sdk/installing/index.jd
@@ -1,4 +1,5 @@
 page.title=Installing the Android SDK
+excludeFromSuggestions=true
 
 page.tags=sdk tools
 helpoutsWidget=true
diff --git a/docs/html/tools/help/adt.jd b/docs/html/tools/help/adt.jd
index 0130524..8abe1b4 100644
--- a/docs/html/tools/help/adt.jd
+++ b/docs/html/tools/help/adt.jd
@@ -509,10 +509,10 @@
 revision of the Android SDK Tools. If such dependencies exist, you will need to
 update the SDK Tools package of the SDK after installing the new revision of
 ADT. To update the SDK Tools package, use the Android SDK Manager, as
-described in <a href="{@docRoot}sdk/exploring.html">Exploring the SDK</a>.</p>
+described in <a href="{@docRoot}sdk/installing/adding-packages.html">Adding SDK Packages</a>.</p>
 
 <p>To learn about new features of each ADT revision and also any dependencies on
-the SDK Tools, see the listings in the <a href="#notes">Revisions</a>
+the SDK Tools, see the listings in the <a href="{@docRoot}tools/revisions/index.html">Revisions</a>
 section. To determine the version currently installed, open the
 Eclipse Installed Software window using <strong>Help</strong>
 &gt; <strong>Software Updates</strong> and refer to the version listed for
diff --git a/docs/html/tools/help/monkey.jd b/docs/html/tools/help/monkey.jd
index b6300a7..941f5d9 100644
--- a/docs/html/tools/help/monkey.jd
+++ b/docs/html/tools/help/monkey.jd
@@ -12,7 +12,7 @@
 <a name="overview"></a>
 <h2>Overview</h2>
 
-<p>The Monkey is a command-line tool that that you can run on any emulator
+<p>The Monkey is a command-line tool that you can run on any emulator
 instance or on a device.  It sends a pseudo-random stream of 
 user events into the system, which acts as a stress test on the application software you are 
 developing.</p>
diff --git a/docs/html/tools/help/uiautomator/UiSelector.jd b/docs/html/tools/help/uiautomator/UiSelector.jd
index 6d5b4e4..7084540 100644
--- a/docs/html/tools/help/uiautomator/UiSelector.jd
+++ b/docs/html/tools/help/uiautomator/UiSelector.jd
@@ -1915,7 +1915,7 @@
     <div class="jd-details-descr">
 
   <div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the resource ID
- of the widget, using a regular expression.http://blog.bettersoftwaretesting.com/</p></div>
+ of the widget, using a regular expression.</p></div>
   <div class="jd-tagdata">
       <h5 class="jd-tagtitle">Parameters</h5>
       <table class="jd-tagtable">
diff --git a/docs/html/tools/revisions/studio.jd b/docs/html/tools/revisions/studio.jd
index 422beaa..3806933 100644
--- a/docs/html/tools/revisions/studio.jd
+++ b/docs/html/tools/revisions/studio.jd
@@ -39,9 +39,32 @@
 <p>The sections below provide notes about successive releases of
 Android Studio, as denoted by revision number. </p>
 
+
 <div class="toggle-content opened">
   <p><a href="#" onclick="return toggleContent(this)">
     <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img"
+      alt=""/>Android Studio v1.0.1</a> <em>(December 2014)</em>
+  </p>
+
+  <div class="toggle-content-toggleme">
+    <p>Various fixes and enhancements:</p>
+    <ul>
+      <li>Fixed AVD Manager and <strong>device.xml</strong> file lock issue. </li>
+      <li>Fixed the emulator log on Windows systems. </li>
+      <li>Fixed issue with creating AVDs with Android Studio and Android SDK installed on different
+      drives on Windows systems.</li>
+      <li>Sets the default update channel for new downloads to <strong>Stable</strong>. If you
+      installed the 1.0.0 version of Android Studio and would like stable, production-ready version
+      updates, use <strong>File > Settings > Updates</strong> to change to the <strong>Stable</strong>
+      update channel.
+      </li>
+  </div>
+</div>
+
+
+<div class="toggle-content closed">
+  <p><a href="#" onclick="return toggleContent(this)">
+    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
       alt=""/>Android Studio v1.0</a> <em>(December 2014)</em>
   </p>
 
diff --git a/docs/html/tools/sdk/tools-notes.jd b/docs/html/tools/sdk/tools-notes.jd
index ed48887..e50b7ac 100644
--- a/docs/html/tools/sdk/tools-notes.jd
+++ b/docs/html/tools/sdk/tools-notes.jd
@@ -25,6 +25,33 @@
 <div class="toggle-content opened">
   <p><a href="#" onclick="return toggleContent(this)">
     <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img"
+      alt=""/>SDK Tools, Revision 24.0.2</a> <em>(December 2014)</em>
+  </p>
+
+  <div class="toggle-content-toggleme">
+
+    <dl>
+    <dt>Dependencies:</dt>
+
+    <dd>
+      <ul>
+        <li>Android SDK Platform-tools revision 19 or later.</li>
+      </ul>
+    </dd>
+
+    <dt>General Notes:</dt>
+    <dd>
+      <ul>
+        <li>Fixed issue with creating projects and activities from templates using Eclipse ADT.</li>
+      </ul>
+    </dd>
+  </div>
+</div>
+
+
+<div class="toggle-content closed">
+  <p><a href="#" onclick="return toggleContent(this)">
+    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
       alt=""/>SDK Tools, Revision 24.0.1</a> <em>(December 2014)</em>
   </p>
 
@@ -898,7 +925,7 @@
             <li>Added a flag that sets <em>jumbo mode</em> for DEX files, which allows a larger
               number of strings in the DEX files. Enable this mode by adding the following line to
               the {@code project.properties} file of your project:
-              <pre>set dex.force.jumbo=true</pre></li>
+              <pre>dex.force.jumbo=true</pre></li>
             <li>Improved the build time by pre-dexing libraries (both JAR files and library
               projects).</li>
             <li>Updated the build to generate {@code R} resource classes for library projects
diff --git a/docs/html/tools/studio/index.jd b/docs/html/tools/studio/index.jd
index 7480f57..5b36d5d 100644
--- a/docs/html/tools/studio/index.jd
+++ b/docs/html/tools/studio/index.jd
@@ -338,7 +338,7 @@
 
 <p>An updated setup wizard walks you through the setup processes as
 the wizard updates your system image and emulation requirements, such GPU, and then creates
-an optimized default Android Virtual Device (AVD) based on Android 5 (Lollipop) for speedie and
+an optimized default Android Virtual Device (AVD) based on Android 5 (Lollipop) for speedy and
 reliable emulation. </p>
 <p><img src="{@docRoot}images/tools/studio-setup-wizard.png" /></p>
 <p class="img-caption"><strong>Figure 8.</strong> Setup Wizard</p>
@@ -377,7 +377,7 @@
   the test of time. They are updated roughly bi-weekly or monthly.</li>
   <li><strong>Beta channel</strong>: Beta builds are used for beta-quality releases before a
   production release.</li>
-  <li><strong>Stable channel</strong>: Used for stable, production-read versions.</li>
+  <li><strong>Stable channel</strong>: Used for stable, production-ready versions.</li>
 </ul>
 </p>
 
diff --git a/docs/html/training/location/index.jd b/docs/html/training/location/index.jd
index f0024e2..059a1e9 100644
--- a/docs/html/training/location/index.jd
+++ b/docs/html/training/location/index.jd
@@ -67,9 +67,10 @@
 <h2>Lessons</h2>
 <dl>
   <dt>
-    <b><a href="retrieve-current.html">Retrieving the Current Location</a></b>
+    <b><a href="retrieve-current.html">Getting the Last Known Location</a></b>
   </dt> <dd>
-     Learn how to retrieve the user's current location.
+     Learn how to retrieve the last known location of an Android device, which
+     is usually equivalent to the user's current location.
   </dd> <dt>
     <b><a href="receive-location-updates.html">Receiving Location
     Updates</a></b>
diff --git a/docs/html/training/location/retrieve-current.jd b/docs/html/training/location/retrieve-current.jd
index f079040..5bac3fa 100644
--- a/docs/html/training/location/retrieve-current.jd
+++ b/docs/html/training/location/retrieve-current.jd
@@ -1,386 +1,162 @@
-page.title=Retrieving the Current Location
+page.title=Getting the Last Known Location
 trainingnavtop=true
 @jd:body
+
 <div id="tb-wrapper">
-<div id="tb">
+  <div id="tb">
 
-<h2>This lesson teaches you to</h2>
-<ol>
-    <li><a href="#AppPermissions">Specify App Permissions</a></li>
-    <li><a href="#CheckServices">Check for Google Play services</a></li>
-    <li><a href="#DefineCallbacks">Define Location Services Callbacks</a></li>
-    <li><a href="#ConnectClient">Connect the Location Client</a></li>
-    <li><a href="#GetLocation">Get the Current Location</a></li>
-</ol>
+    <h2>This lesson teaches you how to</h2>
+    <ol>
+      <li><a href="#setup">Set Up Google Play Services</a></li>
+      <li><a href="#permissions">Specify App Permissions</a></li>
+      <li><a href="#play-services">Connect to Google Play Services</a></li>
+      <li><a href="#last-known">Get the Last Known Location</a></li>
+    </ol>
 
-<h2>You should also read</h2>
-<ul>
-    <li>
-        <a href="{@docRoot}google/play-services/setup.html">Setup Google Play Services SDK</a>
-    </li>
-</ul>
+    <h2>You should also read</h2>
+    <ul>
+      <li>
+        <a href="{@docRoot}google/play-services/setup.html">Setting up Google Play
+        Services</a>
+      </li>
+    </ul>
 
-<h2>Try it out</h2>
-
-<div class="download-box">
-  <a href="http://developer.android.com/shareables/training/LocationUpdates.zip" class="button">Download the sample</a>
-  <p class="filename">LocationUpdates.zip</p>
+    <h2>Try it out</h2>
+    <ul>
+      <li>
+        <a href="https://github.com/googlesamples/android-play-location/tree/master/BasicLocationSample" class="external-link">BasicLocationSample</a>
+      </li>
+    </ul>
+  </div>
 </div>
 
-</div>
-</div>
+<p>Using the Google Play services location APIs, your app can request the last
+  known location of the user's device. In most cases, you are interested in the
+  user's current location, which is usually equivalent to the last known
+  location of the device.</p>
 
-<p>
-    Location Services automatically maintains the user's current location, so all your app has to do
-    is retrieve it as needed. The location's accuracy is based on the location permissions you've
-    requested and location sensors that are currently active for the device.
-<p>
-    Location Services sends the current location to your app through a location client, which is
-    an instance of the Location Services class
-<code><a href="{@docRoot}reference/com/google/android/gms/location/LocationClient.html">LocationClient</a></code>.
-    All requests for location information go through this client.
-</p>
-<p class="note">
-    <strong>Note:</strong> Before you start the lesson, be sure that your development environment
-    and test device are set up correctly. To learn more about this, read the
-    <a href="{@docRoot}google/play-services/setup.html">Setup</a> section in the Google Play
-    services guide.
-</p>
-<!--
-    Specify App Permissions
- -->
-<h2 id="AppPermissions">Specify App Permissions</h2>
-<p>
-    Apps that use Location Services must request location permissions. Android has two location
-    permissions: {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION}
-    and {@link android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION}. The
-    permission you choose controls the accuracy of the current location. If you request only coarse
-    location permission, Location Services obfuscates the returned location to an accuracy
-    that's roughly equivalent to a city block.
-</p>
-<p>
-    Requesting {@link android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION} implies
-    a request for {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION}.
-</p>
-<p>
-    For example, to add {@link android.Manifest.permission#ACCESS_COARSE_LOCATION
-    ACCESS_COARSE_LOCATION}, insert the following as a child element of the
-    <code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code>
-    element:
-</p>
-<pre>
-&lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt;
-</pre>
-<!--
-    Check for Google Play Services
- -->
-<h2 id="CheckServices">Check for Google Play Services</h2>
-<p>
-    Location Services is part of the Google Play services APK. Since it's hard to anticipate the
-    state of the user's device, you should always check that the APK is installed before you attempt
-    to connect to Location Services. To check that the APK is installed, call
-<code><a href="{@docRoot}reference/com/google/android/gms/common/GooglePlayServicesUtil.html#isGooglePlayServicesAvailable(android.content.Context)">GooglePlayServicesUtil.isGooglePlayServicesAvailable()</a></code>,
-    which returns one of the
-    integer result codes listed in the reference documentation for
-<code><a href="{@docRoot}reference/com/google/android/gms/common/ConnectionResult.html">ConnectionResult</a></code>.
-    If you encounter an error, call
-<code><a href="{@docRoot}reference/com/google/android/gms/common/GooglePlayServicesUtil.html#getErrorDialog(int, android.app.Activity, int)">GooglePlayServicesUtil.getErrorDialog()</a></code>
-    to retrieve localized dialog that prompts users to take the correct action, then display
-    the dialog in a {@link android.support.v4.app.DialogFragment}. The dialog may allow the
-    user to correct the problem, in which case Google Play services may send a result back to your
-    activity. To handle this result, override the method
-    {@link android.support.v4.app.FragmentActivity#onActivityResult onActivityResult()}.
-</p>
-<p>
-    Since you usually need to check for Google Play services in more than one place in your code,
-    define a method that encapsulates the check, then call the method before each connection
-    attempt. The following snippet contains all of the code required to check for Google
-    Play services:
-</p>
-<pre>
-public class MainActivity extends FragmentActivity {
-    ...
-    // Global constants
-    /*
-     * Define a request code to send to Google Play services
-     * This code is returned in Activity.onActivityResult
-     */
-    private final static int
-            CONNECTION_FAILURE_RESOLUTION_REQUEST = 9000;
-    ...
-    // Define a DialogFragment that displays the error dialog
-    public static class ErrorDialogFragment extends DialogFragment {
-        // Global field to contain the error dialog
-        private Dialog mDialog;
-        // Default constructor. Sets the dialog field to null
-        public ErrorDialogFragment() {
-            super();
-            mDialog = null;
-        }
-        // Set the dialog to display
-        public void setDialog(Dialog dialog) {
-            mDialog = dialog;
-        }
-        // Return a Dialog to the DialogFragment.
-        &#64;Override
-        public Dialog onCreateDialog(Bundle savedInstanceState) {
-            return mDialog;
-        }
-    }
-    ...
-    /*
-     * Handle results returned to the FragmentActivity
-     * by Google Play services
-     */
-    &#64;Override
-    protected void onActivityResult(
-            int requestCode, int resultCode, Intent data) {
-        // Decide what to do based on the original request code
-        switch (requestCode) {
-            ...
-            case CONNECTION_FAILURE_RESOLUTION_REQUEST :
-            /*
-             * If the result code is Activity.RESULT_OK, try
-             * to connect again
-             */
-                switch (resultCode) {
-                    case Activity.RESULT_OK :
-                    /*
-                     * Try the request again
-                     */
-                    ...
-                    break;
-                }
-            ...
-        }
-     }
-    ...
-    private boolean servicesConnected() {
-        // Check that Google Play services is available
-        int resultCode =
-                GooglePlayServicesUtil.
-                        isGooglePlayServicesAvailable(this);
-        // If Google Play services is available
-        if (ConnectionResult.SUCCESS == resultCode) {
-            // In debug mode, log the status
-            Log.d("Location Updates",
-                    "Google Play services is available.");
-            // Continue
-            return true;
-        // Google Play services was not available for some reason.
-        // resultCode holds the error code.
-        } else {
-            // Get the error dialog from Google Play services
-            Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
-                    resultCode,
-                    this,
-                    CONNECTION_FAILURE_RESOLUTION_REQUEST);
+<p>Specifically, use the
+  <a href="{@docRoot}reference/com/google/android/gms/location/FusedLocationProviderApi.html">fused
+  location provider</a> to retrieve the device's last known location. The fused
+  location provider is one of the location APIs in Google Play services. It
+  manages the underlying location technology and provides a simple API so that
+  you can specify requirements at a high level, like high accuracy or low power.
+  It also optimizes the device's use of battery power.</p>
 
-            // If Google Play services can provide an error dialog
-            if (errorDialog != null) {
-                // Create a new DialogFragment for the error dialog
-                ErrorDialogFragment errorFragment =
-                        new ErrorDialogFragment();
-                // Set the dialog in the DialogFragment
-                errorFragment.setDialog(errorDialog);
-                // Show the error dialog in the DialogFragment
-                errorFragment.show(getSupportFragmentManager(),
-                        "Location Updates");
-            }
-        }
-    }
-    ...
-}
-</pre>
-<p>
-    Snippets in the following sections call this method to verify that Google Play services is
-    available.
-</p>
-<!--
-    Define Location Services Callbacks
- -->
-<h2 id="DefineCallbacks">Define Location Services Callbacks</h2>
-<p>
-    To get the current location, create a location client, connect it
-    to Location Services, and then call its
-<code><a href="{@docRoot}reference/com/google/android/gms/location/LocationClient.html#getLastLocation()">getLastLocation()</a></code>
-    method. The return value  is the best, most recent location, based on the permissions your
-    app requested and the currently-enabled location sensors.
-<p>
-<p>
-    Before you create the location client, implement the interfaces that Location Services uses to
-    communicate with your app:
-</p>
-<dl>
-    <dt>
-<code><a href="{@docRoot}reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html">ConnectionCallbacks</a></code>
-    </dt>
-    <dd>
-        Specifies methods that Location Services calls when a location client is connected or
-        disconnected.
-    </dd>
-    <dt>
-<code><a href="{@docRoot}reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html">OnConnectionFailedListener</a></code>
-    </dt>
-    <dd>
-        Specifies a method that Location Services calls if an error occurs while attempting to
-        connect the location client. This method uses the previously-defined {@code showErrorDialog}
-        method to display an error dialog that attempts to fix the problem using Google Play
-        services.
-    </dd>
-</dl>
-<p>
-    The following snippet shows how to specify the interfaces and define the methods:
-</p>
-<pre>
-public class MainActivity extends FragmentActivity implements
-        GooglePlayServicesClient.ConnectionCallbacks,
-        GooglePlayServicesClient.OnConnectionFailedListener {
-    ...
-    /*
-     * Called by Location Services when the request to connect the
-     * client finishes successfully. At this point, you can
-     * request the current location or start periodic updates
-     */
-    &#64;Override
-    public void onConnected(Bundle dataBundle) {
-        // Display the connection status
-        Toast.makeText(this, "Connected", Toast.LENGTH_SHORT).show();
+<p>This lesson shows you how to make a single request for the location of a
+  device using the
+  <a href="{@docRoot}reference/com/google/android/gms/location/FusedLocationProviderApi.html#getLastLocation(com.google.android.gms.common.api.GoogleApiClient)">{@code getLastLocation()}</a>
+  method in the fused location provider.
 
-    }
+<h2 id="setup">Set Up Google Play Services</h2>
+
+<p>To access the fused location provider, your app's development project must
+  include Google Play services. Download and install the Google Play services
+  component via the <a href="{@docRoot}tools/help/sdk-manager.html">SDK
+  Manager</a> and add the library to your project. For details, see the guide to
+  <a href="{@docRoot}google/play-services/setup.html">Setting Up Google Play
+  Services</a>.</p>
+
+<h2 id="permissions">Specify App Permissions</h2>
+
+<p>Apps that use location services must request location permissions. Android
+  offers two location permissions:
+  {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION}
+  and
+  {@link android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION}.
+  The permission you choose determines the accuracy of the location returned by
+  the API. If you specify
+  {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION},
+  the API returns a location with an accuracy approximately equivalent to a city
+  block.</p>
+
+<p>This lesson requires only coarse location. Request this permission with the
+  {@code uses-permission} element in your app manifest, as shown in the
+  following example:
+
+<pre>
+&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.google.android.gms.location.sample.basiclocationsample" &gt;
+  
+  &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt;
+&lt;/manifest&gt;
+</pre>
+
+<h2 id="play-services">Connect to Google Play Services</h2>
+
+<p>To connect to the API, you need to create an instance of the
+  Google Play services API client. For details about using the client, see
+  the guide to
+  <a href="{@docRoot}google/auth/api-client.html#Starting">Accessing Google
+  APIs</a>.
+</p>
+
+<p>In your activity's {@link android.app.Activity#onCreate onCreate()} method,
+  create an instance of Google API Client using
+  <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.Builder.html">{@code GoogleApiClient.Builder}</a>.
+  Use the builder to add the
+  <a href="{@docRoot}reference/com/google/android/gms/location/LocationServices.html">{@code LocationServices}</a>
+  API.</p>
+
+<p>The sample app defines a {@code buildGoogleApiClient()} method, called from
+  the activity's {@link android.app.Activity#onCreate onCreate()} method,
+  which includes the following code.</p>
+
+<pre>
+protected synchronized void buildGoogleApiClient() {
+    mGoogleApiClient = new GoogleApiClient.Builder(this)
+        .addConnectionCallbacks(this)
+        .addOnConnectionFailedListener(this)
+        .addApi(LocationServices.API)
+        .build();
+}
+</pre>
+
+<h2 id="last-known">Get the Last Known Location</h2>
+
+<p>Once you have connected to Google Play services and the location services
+  API, you can get the last known location of a user's device. When your app is
+  connected to these you can use the fused location provider's
+  <a href="{@docRoot}reference/com/google/android/gms/location/FusedLocationProviderApi.html#getLastLocation(com.google.android.gms.common.api.GoogleApiClient)">{@code getLastLocation()}</a>
+  method to retrieve the device location. The precision of the location returned
+  by this call is determined by the permission setting you put in your app
+  manifest, as described in the <a href="#permissions">Specify App
+  Permissions</a> section of this document.</p>
+
+<p>To request the last known location, call the
+  <a href="{@docRoot}reference/com/google/android/gms/location/FusedLocationProviderApi.html#getLastLocation(com.google.android.gms.common.api.GoogleApiClient)">{@code getLastLocation()}</a>
+  method, passing it your instance of the
+  <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html">{@code GoogleApiClient}</a>
+  object. Do this in the
+  <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.ConnectionCallbacks.html#onConnected(android.os.Bundle)">{@code onConnected()}</a>
+  callback provided by Google API Client, which is called when the client is
+  ready. The following code sample illustrates the request and a simple
+  handling of the response:</p>
+
+<pre>
+public class MainActivity extends ActionBarActivity implements
+        ConnectionCallbacks, OnConnectionFailedListener {
     ...
-    /*
-     * Called by Location Services if the connection to the
-     * location client drops because of an error.
-     */
     &#64;Override
-    public void onDisconnected() {
-        // Display the connection status
-        Toast.makeText(this, "Disconnected. Please re-connect.",
-                Toast.LENGTH_SHORT).show();
-    }
-    ...
-    /*
-     * Called by Location Services if the attempt to
-     * Location Services fails.
-     */
-    &#64;Override
-    public void onConnectionFailed(ConnectionResult connectionResult) {
-        /*
-         * Google Play services can resolve some errors it detects.
-         * If the error has a resolution, try sending an Intent to
-         * start a Google Play services activity that can resolve
-         * error.
-         */
-        if (connectionResult.hasResolution()) {
-            try {
-                // Start an Activity that tries to resolve the error
-                connectionResult.startResolutionForResult(
-                        this,
-                        CONNECTION_FAILURE_RESOLUTION_REQUEST);
-                /*
-                 * Thrown if Google Play services canceled the original
-                 * PendingIntent
-                 */
-            } catch (IntentSender.SendIntentException e) {
-                // Log the error
-                e.printStackTrace();
-            }
-        } else {
-            /*
-             * If no resolution is available, display a dialog to the
-             * user with the error.
-             */
-            showErrorDialog(connectionResult.getErrorCode());
+    public void onConnected(Bundle connectionHint) {
+        mLastLocation = LocationServices.FusedLocationApi.getLastLocation(
+                mGoogleApiClient);
+        if (mLastLocation != null) {
+            mLatitudeText.setText(String.valueOf(mLastLocation.getLatitude()));
+            mLongitudeText.setText(String.valueOf(mLastLocation.getLongitude()));
         }
     }
-    ...
 }
 </pre>
-<!--
-    Connect the Location Client
- -->
-<h2 id="ConnectClient">Connect the Location Client</h2>
-<p>
-    Now that the callback methods are in place, create the location client and connect it to
-    Location Services.
-</p>
-<p>
-    You should create the location client in {@link android.support.v4.app.FragmentActivity#onCreate
-    onCreate()}, then connect it in
-    {@link android.support.v4.app.FragmentActivity#onStart onStart()}, so that Location Services
-    maintains the current location while your activity is fully visible. Disconnect the client in
-    {@link android.support.v4.app.FragmentActivity#onStop onStop()}, so that when your app is not
-    visible, Location Services is not maintaining the current location. Following this pattern of
-    connection and disconnection helps save battery power. For example:
-</p>
-<p class="note">
-    <strong>Note:</strong> The current location is only maintained while a location client is
-    connected to Location Service. Assuming that no other apps are connected to Location Services,
-    if you disconnect the client and then sometime later call
-<code><a href="{@docRoot}reference/com/google/android/gms/location/LocationClient.html#getLastLocation()">getLastLocation()</a></code>,
-    the result may be out of date.
-</p>
-<pre>
-public class MainActivity extends FragmentActivity implements
-        GooglePlayServicesClient.ConnectionCallbacks,
-        GooglePlayServicesClient.OnConnectionFailedListener {
-    ...
-    &#64;Override
-    protected void onCreate(Bundle savedInstanceState) {
-        ...
-        /*
-         * Create a new location client, using the enclosing class to
-         * handle callbacks.
-         */
-        mLocationClient = new LocationClient(this, this, this);
-        ...
-    }
-    ...
-    /*
-     * Called when the Activity becomes visible.
-     */
-    &#64;Override
-    protected void onStart() {
-        super.onStart();
-        // Connect the client.
-        mLocationClient.connect();
-    }
-    ...
-    /*
-     * Called when the Activity is no longer visible.
-     */
-    &#64;Override
-    protected void onStop() {
-        // Disconnecting the client invalidates it.
-        mLocationClient.disconnect();
-        super.onStop();
-    }
-    ...
-}
-</pre>
-<!--
-    Get the Current Location
- -->
-<h2 id="GetLocation">Get the Current Location</h2>
-<p>
-    To get the current location, call
-<code><a href="{@docRoot}reference/com/google/android/gms/location/LocationClient.html#getLastLocation()">getLastLocation()</a></code>.
-    For example:
-</p>
-<pre>
-public class MainActivity extends FragmentActivity implements
-        GooglePlayServicesClient.ConnectionCallbacks,
-        GooglePlayServicesClient.OnConnectionFailedListener {
-    ...
-    // Global variable to hold the current location
-    Location mCurrentLocation;
-    ...
-    mCurrentLocation = mLocationClient.getLastLocation();
-    ...
-}
-</pre>
-<p>
-    The next lesson, <a href="receive-location-updates.html">Receiving Location Updates</a>, shows
-    you how to receive periodic location updates from Location Services.
-</p>
+
+<p>The
+  <a href="{@docRoot}reference/com/google/android/gms/location/FusedLocationProviderApi.html#getLastLocation(com.google.android.gms.common.api.GoogleApiClient)">{@code getLastLocation()}</a>
+  method returns a
+  <a href="{@docRoot}reference/android/location/Location.html">{@code Location}</a>
+  object from which you can retrieve the latitude and longitude coordinates of a
+  geographic location. The location object returned may be null in rare cases
+  when the location is not available.</p>
+
+<p>The next lesson,
+  <a href="receive-location-updates.html">Receiving Location Updates</a>, shows
+  you how to receive periodic location updates.</p>
diff --git a/docs/html/training/multiscreen/screendensities.jd b/docs/html/training/multiscreen/screendensities.jd
index 7817830..fcb65cc 100644
--- a/docs/html/training/multiscreen/screendensities.jd
+++ b/docs/html/training/multiscreen/screendensities.jd
@@ -15,8 +15,8 @@
 
 
 <!-- This is the training bar -->
-<div id="tb-wrapper"> 
-<div id="tb"> 
+<div id="tb-wrapper">
+<div id="tb">
 
 <h2>This lesson teaches you to</h2>
 <ol>
@@ -33,16 +33,15 @@
 </ul>
 
 <h2>Try it out</h2>
- 
-<div class="download-box"> 
+
+<div class="download-box">
 <a href="http://developer.android.com/shareables/training/NewsReader.zip" class="button">Download
   the sample app</a>
-<p class="filename">NewsReader.zip</p> 
-</div> 
- 
- 
-</div> 
-</div> 
+<p class="filename">NewsReader.zip</p>
+</div>
+
+</div>
+</div>
 
 <p>This lesson shows you how to support different screen densities
 by providing different resources and using resolution-independent units of
@@ -54,19 +53,29 @@
 absolute pixels to define distances or sizes. Defining layout dimensions with
 pixels is a problem because different screens have different pixel densities,
 so the same number of pixels may correspond to different physical sizes on
-different devices. Therefore, when specifying dimensions, always use either 
+different devices. Therefore, when specifying dimensions, always use either
 <code>dp</code> or <code>sp</code> units. A <code>dp</code> is a density-independent pixel
 that corresponds to the physical size of a pixel at 160 dpi. An <code>sp</code> is the same
 base unit, but is scaled by the user's preferred text size (it’s a
 scale-independent pixel), so you should use this measurement unit when defining
 text size (but never for layout sizes).</p>
 
-<p>For example, when you specify spacing between two views, use <code>dp</code> 
+ <!-- video box -->
+<a class="notice-developers-video left" href="https://www.youtube.com/watch?v=zhszwkcay2A">
+<div>
+    <h3>Video</h3>
+    <p>DesignBytes: Density-independent Pixels</p>
+</div>
+</a>
+
+<br style="clear:left">
+
+<p>For example, when you specify spacing between two views, use <code>dp</code>
 rather than <code>px</code>:</p>
 
 <pre>
-&lt;Button android:layout_width="wrap_content" 
-    android:layout_height="wrap_content" 
+&lt;Button android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
     android:text="&#64;string/clickme"
     android:layout_marginTop="20dp" /&gt;
 </pre>
@@ -74,8 +83,8 @@
 <p>When specifying text size, always use <code>sp</code>:</p>
 
 <pre>
-&lt;TextView android:layout_width="match_parent" 
-    android:layout_height="wrap_content" 
+&lt;TextView android:layout_width="match_parent"
+    android:layout_height="wrap_content"
     android:textSize="20sp" /&gt;
 </pre>
 
diff --git a/docs/html/training/training_toc.cs b/docs/html/training/training_toc.cs
index f3b2693..2489b91 100644
--- a/docs/html/training/training_toc.cs
+++ b/docs/html/training/training_toc.cs
@@ -694,7 +694,7 @@
         <ul>
           <li>
             <a href="<?cs var:toroot ?>training/location/retrieve-current.html">
-            Retrieving the Current Location
+            Getting the Last Known Location
             </a>
           </li>
           <li>
diff --git a/docs/html/training/tv/playback/index.jd b/docs/html/training/tv/playback/index.jd
index 31c7524..5427d48 100644
--- a/docs/html/training/tv/playback/index.jd
+++ b/docs/html/training/tv/playback/index.jd
@@ -17,9 +17,20 @@
     <li><a href="{@docRoot}design/tv/index.html">
       Design for TV</a></li>
   </ul>
+
 </div>
 </div>
 
+  <!-- video box -->
+<a class="notice-developers-video" href="https://www.youtube.com/watch?v=72K1VhjoL98">
+<div>
+    <h3>Video</h3>
+    <p>DevBytes: Android TV &mdash; Using the Leanback library</p>
+</div>
+</a>
+
+
+
 <p>
   Browsing and playing media files is frequently part of the user experience provided by a TV app.
   Building such an experience from scratch, while making sure that it is fast, fluid, and attractive
diff --git a/libs/hwui/DeferredDisplayList.cpp b/libs/hwui/DeferredDisplayList.cpp
index fab4a1a..a998594 100644
--- a/libs/hwui/DeferredDisplayList.cpp
+++ b/libs/hwui/DeferredDisplayList.cpp
@@ -525,7 +525,7 @@
     deferInfo.mergeable &= !recordingComplexClip();
     deferInfo.opaqueOverBounds &= !recordingComplexClip() && mSaveStack.isEmpty();
 
-    if (mBatches.size() &&
+    if (CC_LIKELY(mAvoidOverdraw) && mBatches.size() &&
             state->mClipSideFlags != kClipSide_ConservativeFull &&
             deferInfo.opaqueOverBounds && state->mBounds.contains(mBounds)) {
         // avoid overdraw by resetting drawing state + discarding drawing ops
@@ -677,12 +677,13 @@
     DrawModifiers restoreDrawModifiers = renderer.getDrawModifiers();
     renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
 
-    for (unsigned int i = 1; i < mBatches.size(); i++) {
-        if (mBatches[i] && mBatches[i]->coversBounds(mBounds)) {
-            discardDrawingBatches(i - 1);
+    if (CC_LIKELY(mAvoidOverdraw)) {
+        for (unsigned int i = 1; i < mBatches.size(); i++) {
+            if (mBatches[i] && mBatches[i]->coversBounds(mBounds)) {
+                discardDrawingBatches(i - 1);
+            }
         }
     }
-
     // NOTE: depth of the save stack at this point, before playback, should be reflected in
     // FLUSH_SAVE_STACK_DEPTH, so that save/restores match up correctly
     status |= replayBatchList(mBatches, renderer, dirty);
diff --git a/libs/hwui/DeferredDisplayList.h b/libs/hwui/DeferredDisplayList.h
index 885b411..8a015b21 100644
--- a/libs/hwui/DeferredDisplayList.h
+++ b/libs/hwui/DeferredDisplayList.h
@@ -81,8 +81,8 @@
 class DeferredDisplayList {
     friend class DeferStateStruct; // used to give access to allocator
 public:
-    DeferredDisplayList(const Rect& bounds) :
-            mBounds(bounds) {
+    DeferredDisplayList(const Rect& bounds, bool avoidOverdraw = true) :
+            mBounds(bounds), mAvoidOverdraw(avoidOverdraw) {
         clear();
     }
     ~DeferredDisplayList() { clear(); }
@@ -150,6 +150,7 @@
 
     // layer space bounds of rendering
     Rect mBounds;
+    const bool mAvoidOverdraw;
 
     /**
      * At defer time, stores the *defer time* savecount of save/saveLayer ops that were deferred, so
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 7285496..6f1e8a2 100755
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1912,7 +1912,10 @@
             return status | replayStruct.mDrawGlStatus;
         }
 
-        DeferredDisplayList deferredList(*currentClipRect());
+        // Don't avoid overdraw when visualizing, since that makes it harder to
+        // debug where it's coming from, and when the problem occurs.
+        bool avoidOverdraw = !mCaches.debugOverdraw;
+        DeferredDisplayList deferredList(*currentClipRect(), avoidOverdraw);
         DeferStateStruct deferStruct(deferredList, *this, replayFlags);
         renderNode->defer(deferStruct, 0);
 
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index f0150d4..1c10422 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -1841,12 +1841,22 @@
     }
 
     public void setRingerModeExternal(int ringerMode, String caller) {
-        setRingerMode(ringerMode, caller, true /*external*/);
+        final long identity = Binder.clearCallingIdentity();
+        try {
+            setRingerMode(ringerMode, caller, true /*external*/);
+        } finally {
+            Binder.restoreCallingIdentity(identity);
+        }
     }
 
     public void setRingerModeInternal(int ringerMode, String caller) {
         enforceSelfOrSystemUI("setRingerModeInternal");
-        setRingerMode(ringerMode, caller, false /*external*/);
+        final long identity = Binder.clearCallingIdentity();
+        try {
+            setRingerMode(ringerMode, caller, false /*external*/);
+        } finally {
+            Binder.restoreCallingIdentity(identity);
+        }
     }
 
     private void setRingerMode(int ringerMode, String caller, boolean external) {
@@ -1860,26 +1870,28 @@
         if ((ringerMode == AudioManager.RINGER_MODE_VIBRATE) && !mHasVibrator) {
             ringerMode = AudioManager.RINGER_MODE_SILENT;
         }
-        final int ringerModeInternal = getRingerModeInternal();
-        final int ringerModeExternal = getRingerModeExternal();
-        if (external) {
-            setRingerModeExt(ringerMode);
-            if (mRingerModeDelegate != null) {
-                ringerMode = mRingerModeDelegate.onSetRingerModeExternal(ringerModeExternal,
-                        ringerMode, caller, ringerModeInternal);
+        synchronized (mSettingsLock) {
+            final int ringerModeInternal = getRingerModeInternal();
+            final int ringerModeExternal = getRingerModeExternal();
+            if (external) {
+                setRingerModeExt(ringerMode);
+                if (mRingerModeDelegate != null) {
+                    ringerMode = mRingerModeDelegate.onSetRingerModeExternal(ringerModeExternal,
+                            ringerMode, caller, ringerModeInternal);
+                }
+                if (ringerMode != ringerModeInternal) {
+                    setRingerModeInt(ringerMode, true /*persist*/);
+                }
+            } else /*internal*/ {
+                if (ringerMode != ringerModeInternal) {
+                    setRingerModeInt(ringerMode, true /*persist*/);
+                }
+                if (mRingerModeDelegate != null) {
+                    ringerMode = mRingerModeDelegate.onSetRingerModeInternal(ringerModeInternal,
+                            ringerMode, caller, ringerModeExternal);
+                }
+                setRingerModeExt(ringerMode);
             }
-            if (ringerMode != ringerModeInternal) {
-                setRingerModeInt(ringerMode, true /*persist*/);
-            }
-        } else /*internal*/ {
-            if (ringerMode != ringerModeInternal) {
-                setRingerModeInt(ringerMode, true /*persist*/);
-            }
-            if (mRingerModeDelegate != null) {
-                ringerMode = mRingerModeDelegate.onSetRingerModeInternal(ringerModeInternal,
-                        ringerMode, caller, ringerModeExternal);
-            }
-            setRingerModeExt(ringerMode);
         }
     }
 
@@ -1968,10 +1980,10 @@
         switch (getVibrateSetting(vibrateType)) {
 
             case AudioManager.VIBRATE_SETTING_ON:
-                return getRingerModeInternal() != AudioManager.RINGER_MODE_SILENT;
+                return getRingerModeExternal() != AudioManager.RINGER_MODE_SILENT;
 
             case AudioManager.VIBRATE_SETTING_ONLY_SILENT:
-                return getRingerModeInternal() == AudioManager.RINGER_MODE_VIBRATE;
+                return getRingerModeExternal() == AudioManager.RINGER_MODE_VIBRATE;
 
             case AudioManager.VIBRATE_SETTING_OFF:
                 // return false, even for incoming calls
@@ -3236,7 +3248,10 @@
 
         TelecomManager telecomManager =
                 (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
+
+        final long ident = Binder.clearCallingIdentity();
         IsInCall = telecomManager.isInCall();
+        Binder.restoreCallingIdentity(ident);
 
         return (IsInCall || getMode() == AudioManager.MODE_IN_COMMUNICATION);
     }
diff --git a/media/java/android/media/session/MediaSessionLegacyHelper.java b/media/java/android/media/session/MediaSessionLegacyHelper.java
index 4b9a929..7ea269b 100644
--- a/media/java/android/media/session/MediaSessionLegacyHelper.java
+++ b/media/java/android/media/session/MediaSessionLegacyHelper.java
@@ -69,12 +69,9 @@
     }
 
     public static MediaSessionLegacyHelper getHelper(Context context) {
-        if (DEBUG) {
-            Log.d(TAG, "Attempting to get helper with context " + context);
-        }
         synchronized (sLock) {
             if (sInstance == null) {
-                sInstance = new MediaSessionLegacyHelper(context);
+                sInstance = new MediaSessionLegacyHelper(context.getApplicationContext());
             }
         }
         return sInstance;
diff --git a/packages/CaptivePortalLogin/assets/locked_page.png b/packages/CaptivePortalLogin/assets/locked_page.png
new file mode 100644
index 0000000..91e1291
--- /dev/null
+++ b/packages/CaptivePortalLogin/assets/locked_page.png
Binary files differ
diff --git a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
index 7253579..06e8574 100644
--- a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
+++ b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
@@ -28,6 +28,7 @@
 import android.net.NetworkRequest;
 import android.net.Proxy;
 import android.net.Uri;
+import android.net.http.SslError;
 import android.os.Bundle;
 import android.provider.Settings;
 import android.provider.Settings.Global;
@@ -37,6 +38,7 @@
 import android.view.MenuItem;
 import android.view.View;
 import android.view.Window;
+import android.webkit.SslErrorHandler;
 import android.webkit.WebChromeClient;
 import android.webkit.WebSettings;
 import android.webkit.WebView;
@@ -251,6 +253,19 @@
             }
             testForCaptivePortal();
         }
+
+        // A web page consisting of a large broken lock icon to indicate SSL failure.
+        final static String SSL_ERROR_HTML = "<!DOCTYPE html><html><head><style>" +
+                "html { width:100%; height:100%; " +
+                "       background:url(locked_page.png) center center no-repeat; }" +
+                "</style></head><body></body></html>";
+
+        @Override
+        public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
+            Log.w(TAG, "SSL error; displaying broken lock icon.");
+            view.loadDataWithBaseURL("file:///android_asset/", SSL_ERROR_HTML, "text/HTML",
+                    "UTF-8", null);
+        }
     }
 
     private class MyWebChromeClient extends WebChromeClient {
diff --git a/packages/SystemUI/res/values-en-rGB/strings.xml b/packages/SystemUI/res/values-en-rGB/strings.xml
index e1cd73a0..f61724d 100644
--- a/packages/SystemUI/res/values-en-rGB/strings.xml
+++ b/packages/SystemUI/res/values-en-rGB/strings.xml
@@ -266,7 +266,7 @@
     <string name="quick_settings_tethering_label" msgid="7153452060448575549">"Tethering"</string>
     <string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
     <string name="quick_settings_notifications_label" msgid="4818156442169154523">"Notifications"</string>
-    <string name="quick_settings_flashlight_label" msgid="2133093497691661546">"Flashlight"</string>
+    <string name="quick_settings_flashlight_label" msgid="2133093497691661546">"Torch"</string>
     <string name="quick_settings_cellular_detail_title" msgid="8575062783675171695">"Mobile data"</string>
     <string name="quick_settings_cellular_detail_data_usage" msgid="1964260360259312002">"Data usage"</string>
     <string name="quick_settings_cellular_detail_remaining_data" msgid="722715415543541249">"Remaining data"</string>
diff --git a/packages/SystemUI/res/values-en-rIN/strings.xml b/packages/SystemUI/res/values-en-rIN/strings.xml
index e1cd73a0..f61724d 100644
--- a/packages/SystemUI/res/values-en-rIN/strings.xml
+++ b/packages/SystemUI/res/values-en-rIN/strings.xml
@@ -266,7 +266,7 @@
     <string name="quick_settings_tethering_label" msgid="7153452060448575549">"Tethering"</string>
     <string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
     <string name="quick_settings_notifications_label" msgid="4818156442169154523">"Notifications"</string>
-    <string name="quick_settings_flashlight_label" msgid="2133093497691661546">"Flashlight"</string>
+    <string name="quick_settings_flashlight_label" msgid="2133093497691661546">"Torch"</string>
     <string name="quick_settings_cellular_detail_title" msgid="8575062783675171695">"Mobile data"</string>
     <string name="quick_settings_cellular_detail_data_usage" msgid="1964260360259312002">"Data usage"</string>
     <string name="quick_settings_cellular_detail_remaining_data" msgid="722715415543541249">"Remaining data"</string>
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
index 6e710ef..fcc517f 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
@@ -88,9 +88,7 @@
 
     @Override
     protected void handleUpdateState(BooleanState state, Object arg) {
-        state.visible = mController.isHotspotSupported() && mUsageTracker.isRecentlyUsed()
-                && !(mController.isProvisioningNeeded() && mKeyguard.isSecure()
-                && mKeyguard.isShowing());
+        state.visible = mController.isHotspotSupported() && mUsageTracker.isRecentlyUsed();
         state.label = mContext.getString(R.string.quick_settings_hotspot_label);
 
         state.value = mController.isHotspotEnabled();
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
index 3e6611a..10618e0 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -603,7 +603,7 @@
             mStartAnimationTriggered = false;
             return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,
                     thumbnail, toTaskRect.left, toTaskRect.top, toTaskRect.width(),
-                    toTaskRect.height(), this);
+                    toTaskRect.height(), mHandler, this);
         }
 
         // If both the screenshot and thumbnail fails, then just fall back to the default transition
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
index 746a7df..ee79242 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
@@ -477,7 +477,7 @@
             }
             opts = ActivityOptions.makeThumbnailAspectScaleUpAnimation(sourceView,
                     b, offsetX, offsetY, transform.rect.width(), transform.rect.height(),
-                    animStartedListener);
+                    sourceView.getHandler(), animStartedListener);
         }
 
         final ActivityOptions launchOpts = opts;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java
index fbcba0b..59b62e5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java
@@ -53,6 +53,9 @@
     private ImageView mIcon;
     protected ImageView mPicture;
 
+    /** Whether the icon needs to be forced grayscale when in dark mode. */
+    private boolean mIconForceGraysaleWhenDark;
+
     protected NotificationTemplateViewWrapper(Context ctx, View view) {
         super(view);
         mIconDarkAlpha = ctx.getResources().getInteger(R.integer.doze_small_icon_alpha);
@@ -73,11 +76,15 @@
         mIcon = resolveIcon(largeIcon, rightIcon);
         mPicture = resolvePicture(largeIcon);
         mIconBackgroundColor = resolveBackgroundColor(mIcon);
+
+        // If the icon already has a color filter, we assume that we already forced the icon to be
+        // white when we created the notification.
+        mIconForceGraysaleWhenDark = mIcon != null && mIcon.getDrawable().getColorFilter() != null;
     }
 
     private ImageView resolveIcon(ImageView largeIcon, ImageView rightIcon) {
         return largeIcon != null && largeIcon.getBackground() != null ? largeIcon
-                : rightIcon != null && rightIcon.getBackground() != null ? rightIcon
+                : rightIcon != null && rightIcon.getVisibility() == View.VISIBLE ? rightIcon
                 : null;
     }
 
@@ -118,9 +125,15 @@
             if (fade) {
                 fadeIconColorFilter(mIcon, dark, delay);
                 fadeIconAlpha(mIcon, dark, delay);
+                if (!mIconForceGraysaleWhenDark) {
+                    fadeGrayscale(mIcon, dark, delay);
+                }
             } else {
                 updateIconColorFilter(mIcon, dark);
                 updateIconAlpha(mIcon, dark);
+                if (!mIconForceGraysaleWhenDark) {
+                    updateGrayscale(mIcon, dark);
+                }
             }
         }
         setPictureGrayscale(dark, fade, delay);
@@ -196,8 +209,8 @@
         mIconColorFilter.setColor(color);
         Drawable background = target.getBackground();
 
-        // The notification might have been modified during the animation, so background might be
-        // null here.
+        // The background might be null for legacy notifications. Also, the notification might have
+        // been modified during the animation, so background might be null here.
         if (background != null) {
             background.mutate().setColorFilter(mIconColorFilter);
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
index b05cb31..5f7d452 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
@@ -36,6 +36,14 @@
 
     private static final String TAG = "HotspotController";
     private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
+    // Keep these in sync with Settings TetherService.java
+    public static final String EXTRA_ADD_TETHER_TYPE = "extraAddTetherType";
+    public static final String EXTRA_SET_ALARM = "extraSetAlarm";
+    public static final String EXTRA_RUN_PROVISION = "extraRunProvision";
+    public static final String EXTRA_ENABLE_WIFI_TETHER = "extraEnableWifiTether";
+    // Keep this in sync with Settings TetherSettings.java
+    public static final int WIFI_TETHERING = 0;
+
     private final ArrayList<Callback> mCallbacks = new ArrayList<Callback>();
     private final Receiver mReceiver = new Receiver();
     private final Context mContext;
@@ -97,9 +105,13 @@
                 String tetherEnable = mContext.getResources().getString(
                         com.android.internal.R.string.config_wifi_tether_enable);
                 Intent intent = new Intent();
+                intent.putExtra(EXTRA_ADD_TETHER_TYPE, WIFI_TETHERING);
+                intent.putExtra(EXTRA_SET_ALARM, true);
+                intent.putExtra(EXTRA_RUN_PROVISION, true);
+                intent.putExtra(EXTRA_ENABLE_WIFI_TETHER, true);
                 intent.setComponent(ComponentName.unflattenFromString(tetherEnable));
                 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-                mContext.startActivityAsUser(intent, UserHandle.CURRENT);
+                mContext.startServiceAsUser(intent, UserHandle.CURRENT);
             } else {
                 int wifiState = mWifiManager.getWifiState();
                 if ((wifiState == WifiManager.WIFI_STATE_ENABLING) ||
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 81c6da5..5eebf3c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -426,6 +426,9 @@
             return;
         }
         List<SubscriptionInfo> subscriptions = mSubscriptionManager.getActiveSubscriptionInfoList();
+        if (subscriptions == null) {
+            subscriptions = Collections.emptyList();
+        }
         // If there have been no relevant changes to any of the subscriptions, we can leave as is.
         if (hasCorrectMobileControllers(subscriptions)) {
             // Even if the controllers are correct, make sure we have the right no sims state.
@@ -500,10 +503,8 @@
     }
 
     private boolean hasCorrectMobileControllers(List<SubscriptionInfo> allSubscriptions) {
-        if (allSubscriptions == null) {
-            // If null then the system doesn't know the subscriptions yet, instead just wait
-            // to update the MobileControllers until it knows the state.
-            return true;
+        if (allSubscriptions.size() != mMobileSignalControllers.size()) {
+            return false;
         }
         for (SubscriptionInfo info : allSubscriptions) {
             if (!mMobileSignalControllers.containsKey(info.getSubscriptionId())) {
@@ -812,7 +813,8 @@
 
     private final OnSubscriptionsChangedListener mSubscriptionListener =
             new OnSubscriptionsChangedListener() {
-        public void onSubscriptionInfoChanged() {
+        @Override
+        public void onSubscriptionsChanged() {
             updateMobileControllers();
         };
     };
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index c468be1..f0c6bb7 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -2452,6 +2452,15 @@
                     return -1;
                 }
 
+                // If an incoming call is ringing, HOME is totally disabled.
+                // (The user is already on the InCallUI at this point,
+                // and his ONLY options are to answer or reject the call.)
+                TelecomManager telecomManager = getTelecommService();
+                if (telecomManager != null && telecomManager.isRinging()) {
+                    Log.i(TAG, "Ignoring HOME; there's a ringing incoming call.");
+                    return -1;
+                }
+
                 // Delay handling home if a double-tap is possible.
                 if (mDoubleTapOnHomeBehavior != DOUBLE_TAP_HOME_NOTHING) {
                     mHandler.removeCallbacks(mHomeDoubleTapTimeoutRunnable); // just in case
diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java
index 541cce8..e86c461 100644
--- a/rs/java/android/renderscript/RenderScript.java
+++ b/rs/java/android/renderscript/RenderScript.java
@@ -1185,7 +1185,7 @@
         }
         mRWLock = new ReentrantReadWriteLock();
         try {
-            registerNativeAllocation.invoke(sRuntime, 4 * 1024 * 1024 * 1024); // 4MB for GC sake
+            registerNativeAllocation.invoke(sRuntime, 4 * 1024 * 1024); // 4MB for GC sake
         } catch (Exception e) {
             Log.e(RenderScript.LOG_TAG, "Couldn't invoke registerNativeAllocation:" + e);
             throw new RSRuntimeException("Couldn't invoke registerNativeAllocation:" + e);
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index 47bf188..a9a756e 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -61,7 +61,6 @@
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.Locale;
-import java.util.Random;
 import java.util.TimeZone;
 
 import static android.app.AlarmManager.RTC_WAKEUP;
@@ -115,12 +114,8 @@
     final Object mLock = new Object();
 
     long mNativeData;
-
-    private final Random mFuzzer = new Random();
-    private long mNextWakeupBatchStart;     // nominal start of next wakeup's delivery window
-    private long mNextWakeup;               // actual scheduled next wakeup within that window
+    private long mNextWakeup;
     private long mNextNonWakeup;
-
     int mBroadcastRefCount = 0;
     PowerManager.WakeLock mWakeLock;
     boolean mLastWakeLockUnimportantForLogging;
@@ -372,27 +367,14 @@
 
     static class BatchTimeOrder implements Comparator<Batch> {
         public int compare(Batch b1, Batch b2) {
-            final long start1 = b1.start;
-            final long start2 = b2.start;
-            if (start1 > start2) {
+            long when1 = b1.start;
+            long when2 = b2.start;
+            if (when1 - when2 > 0) {
                 return 1;
             }
-            if (start1 < start2) {
+            if (when1 - when2 < 0) {
                 return -1;
             }
-
-            // Identical trigger times.  As a secondary ordering, require that
-            // the batch with the shorter allowable delivery window sorts first.
-            final long interval1 = b1.end - b1.start;
-            final long interval2 = b2.end - b2.start;
-            if (interval1 > interval2) {
-                return 1;
-            }
-            if (interval2 < interval1) {
-                return -1;
-            }
-
-            // equal start + delivery window => they're identical
             return 0;
         }
     }
@@ -615,7 +597,7 @@
     @Override
     public void onStart() {
         mNativeData = init();
-        mNextWakeup = mNextWakeupBatchStart = mNextNonWakeup = 0;
+        mNextWakeup = mNextNonWakeup = 0;
 
         // We have to set current TimeZone info to kernel
         // because kernel doesn't keep this after reboot
@@ -823,7 +805,6 @@
                         "AlarmManager.set");
             }
 
-            // Exact alarms are standalone; inexact get batched together
             setImpl(type, triggerAtTime, windowLength, interval, operation,
                     windowLength == AlarmManager.WINDOW_EXACT, workSource, alarmClock);
         }
@@ -896,7 +877,7 @@
 
             pw.print("nowRTC="); pw.print(nowRTC);
             pw.print("="); pw.print(sdf.format(new Date(nowRTC)));
-            pw.print(" nowELAPSED="); pw.print(nowELAPSED);
+            pw.print(" nowELAPSED="); TimeUtils.formatDuration(nowELAPSED, pw);
             pw.println();
             if (!mInteractive) {
                 pw.print("Time since non-interactive: ");
@@ -1102,6 +1083,17 @@
         return true;
     }
 
+    private Batch findFirstWakeupBatchLocked() {
+        final int N = mAlarmBatches.size();
+        for (int i = 0; i < N; i++) {
+            Batch b = mAlarmBatches.get(i);
+            if (b.hasWakeups()) {
+                return b;
+            }
+        }
+        return null;
+    }
+
     private AlarmManager.AlarmClockInfo getNextAlarmClockImpl(int userId) {
         synchronized (mLock) {
             return mNextAlarmClockForUser.get(userId);
@@ -1236,48 +1228,16 @@
         // prior to that which contains no wakeups, we schedule that as well.
         long nextNonWakeup = 0;
         if (mAlarmBatches.size() > 0) {
-            // Find the first wakeup alarm and note the following batch as well.  We'll be
-            // choosing a fuzzed delivery time within the first's allowable interval but
-            // ensuring that it does not encroach on the second's start time, to minimize
-            // alarm reordering.
-            Batch firstWakeup = null, nextAfterWakeup = null;
-            final int N = mAlarmBatches.size();
-            for (int i = 0; i < N; i++) {
-                Batch b = mAlarmBatches.get(i);
-                if (b.hasWakeups()) {
-                    firstWakeup = b;
-                    if (i < N-1) {
-                        nextAfterWakeup = mAlarmBatches.get(i+1);
-                    }
-                    break;
-                }
-            }
-
-            // There's a subtlety here: we depend on the invariant that if two batches
-            // exist with the same start time, the one with the shorter delivery window
-            // is sorted before the other.  This guarantees us that we need only look
-            // at the first [relevant] batch in the queue in order to schedule an alarm
-            // appropriately.
+            final Batch firstWakeup = findFirstWakeupBatchLocked();
             final Batch firstBatch = mAlarmBatches.get(0);
-            if (firstWakeup != null && mNextWakeupBatchStart != firstWakeup.start) {
-                mNextWakeupBatchStart = mNextWakeup = firstWakeup.start;
-                final long windowEnd = (nextAfterWakeup == null)
-                        ? firstWakeup.end
-                        : Math.min(firstWakeup.end, nextAfterWakeup.start);
-                final long interval = windowEnd - firstWakeup.start;
-                // if the interval is over maxint we're into crazy land anyway, but
-                // just in case we check and don't fuzz if the conversion to int for
-                // random-number purposes would blow up
-                if (interval > 0 && interval < Integer.MAX_VALUE) {
-                    mNextWakeup += mFuzzer.nextInt((int) interval);
-                }
-                setLocked(ELAPSED_REALTIME_WAKEUP, mNextWakeup);
+            if (firstWakeup != null && mNextWakeup != firstWakeup.start) {
+                mNextWakeup = firstWakeup.start;
+                setLocked(ELAPSED_REALTIME_WAKEUP, firstWakeup.start);
             }
             if (firstBatch != firstWakeup) {
                 nextNonWakeup = firstBatch.start;
             }
         }
-
         if (mPendingNonWakeupAlarms.size() > 0) {
             if (nextNonWakeup == 0 || mNextNonWakeupDeliveryTime < nextNonWakeup) {
                 nextNonWakeup = mNextNonWakeupDeliveryTime;
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index ca376fd..32a6a2f 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -1521,6 +1521,8 @@
 
     @Override
     public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
+        mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
+
         writer.println("enabled: " + mEnable);
         writer.println("state: " + mState);
         writer.println("address: " + mAddress);
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 499cff3..b1f14a9 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -1048,7 +1048,7 @@
             synchronized (nai) {
                 if (nai.created) {
                     NetworkCapabilities nc = new NetworkCapabilities(nai.networkCapabilities);
-                    if (nai.validated) {
+                    if (nai.lastValidated) {
                         nc.addCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
                     } else {
                         nc.removeCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
@@ -1954,17 +1954,18 @@
                     NetworkAgentInfo nai = (NetworkAgentInfo)msg.obj;
                     if (isLiveNetworkAgent(nai, "EVENT_NETWORK_VALIDATED")) {
                         boolean valid = (msg.arg1 == NetworkMonitor.NETWORK_TEST_RESULT_VALID);
+                        nai.lastValidated = valid;
                         if (valid) {
                             if (DBG) log("Validated " + nai.name());
-                            if (!nai.validated) {
-                                nai.validated = true;
+                            if (!nai.everValidated) {
+                                nai.everValidated = true;
                                 rematchNetworkAndRequests(nai, NascentState.JUST_VALIDATED,
                                     ReapUnvalidatedNetworks.REAP);
                                 // If score has changed, rebroadcast to NetworkFactories. b/17726566
                                 sendUpdatedScoreToFactories(nai);
                             }
                         }
-                        updateInetCondition(nai, valid);
+                        updateInetCondition(nai);
                         // Let the NetworkAgent know the state of its network
                         nai.asyncChannel.sendMessage(
                                 android.net.NetworkAgent.CMD_REPORT_NETWORK_STATUS,
@@ -3949,6 +3950,7 @@
         notifyLockdownVpn(newNetwork);
         handleApplyDefaultProxy(newNetwork.linkProperties.getHttpProxy());
         updateTcpBufferSizes(newNetwork);
+        setDefaultDnsSystemProperties(newNetwork.linkProperties.getDnsServers());
     }
 
     // Handles a network appearing or improving its score.
@@ -3983,11 +3985,12 @@
     private void rematchNetworkAndRequests(NetworkAgentInfo newNetwork, NascentState nascent,
             ReapUnvalidatedNetworks reapUnvalidatedNetworks) {
         if (!newNetwork.created) return;
-        if (nascent == NascentState.JUST_VALIDATED && !newNetwork.validated) {
+        if (nascent == NascentState.JUST_VALIDATED && !newNetwork.everValidated) {
             loge("ERROR: nascent network not validated.");
         }
         boolean keep = newNetwork.isVPN();
         boolean isNewDefault = false;
+        NetworkAgentInfo oldDefaultNetwork = null;
         if (DBG) log("rematching " + newNetwork.name());
         // Find and migrate to this Network any NetworkRequests for
         // which this network is now the best.
@@ -4045,32 +4048,14 @@
                     sendUpdatedScoreToFactories(nri.request, newNetwork.getCurrentScore());
                     if (mDefaultRequest.requestId == nri.request.requestId) {
                         isNewDefault = true;
-                        // TODO: Remove following line.  It's redundant with makeDefault call.
-                        if (newNetwork.linkProperties != null) {
-                            updateTcpBufferSizes(newNetwork);
-                            setDefaultDnsSystemProperties(
-                                    newNetwork.linkProperties.getDnsServers());
-                        } else {
-                            setDefaultDnsSystemProperties(new ArrayList<InetAddress>());
-                        }
-                        // Maintain the illusion: since the legacy API only
-                        // understands one network at a time, we must pretend
-                        // that the current default network disconnected before
-                        // the new one connected.
-                        if (currentNetwork != null) {
-                            mLegacyTypeTracker.remove(currentNetwork.networkInfo.getType(),
-                                                      currentNetwork);
-                        }
-                        mDefaultInetConditionPublished = newNetwork.validated ? 100 : 0;
-                        mLegacyTypeTracker.add(newNetwork.networkInfo.getType(), newNetwork);
-                        notifyLockdownVpn(newNetwork);
+                        oldDefaultNetwork = currentNetwork;
                     }
                 }
             }
         }
         // Linger any networks that are no longer needed.
         for (NetworkAgentInfo nai : affectedNetworks) {
-            boolean teardown = !nai.isVPN() && nai.validated;
+            boolean teardown = !nai.isVPN() && nai.everValidated;
             for (int i = 0; i < nai.networkRequests.size() && teardown; i++) {
                 NetworkRequest nr = nai.networkRequests.valueAt(i);
                 try {
@@ -4104,6 +4089,17 @@
                                 1000);
                     }
                 }
+                // Maintain the illusion: since the legacy API only
+                // understands one network at a time, we must pretend
+                // that the current default network disconnected before
+                // the new one connected.
+                if (oldDefaultNetwork != null) {
+                    mLegacyTypeTracker.remove(oldDefaultNetwork.networkInfo.getType(),
+                                              oldDefaultNetwork);
+                }
+                mDefaultInetConditionPublished = newNetwork.everValidated ? 100 : 0;
+                mLegacyTypeTracker.add(newNetwork.networkInfo.getType(), newNetwork);
+                notifyLockdownVpn(newNetwork);
             }
 
             // Notify battery stats service about this network, both the normal
@@ -4144,7 +4140,7 @@
         }
         if (reapUnvalidatedNetworks == ReapUnvalidatedNetworks.REAP) {
             for (NetworkAgentInfo nai : mNetworkAgentInfos.values()) {
-                if (!nai.created || nai.validated || nai.isVPN()) continue;
+                if (!nai.created || nai.everValidated || nai.isVPN()) continue;
                 boolean reap = true;
                 for (NetworkRequestInfo nri : mNetworkRequests.values()) {
                     // If this Network is already the highest scoring Network for a request, or if
@@ -4205,14 +4201,14 @@
         }
     }
 
-    private void updateInetCondition(NetworkAgentInfo nai, boolean valid) {
+    private void updateInetCondition(NetworkAgentInfo nai) {
         // Don't bother updating until we've graduated to validated at least once.
-        if (!nai.validated) return;
+        if (!nai.everValidated) return;
         // For now only update icons for default connection.
         // TODO: Update WiFi and cellular icons separately. b/17237507
         if (!isDefaultNetwork(nai)) return;
 
-        int newInetCondition = valid ? 100 : 0;
+        int newInetCondition = nai.lastValidated ? 100 : 0;
         // Don't repeat publish.
         if (newInetCondition == mDefaultInetConditionPublished) return;
 
diff --git a/services/core/java/com/android/server/MmsServiceBroker.java b/services/core/java/com/android/server/MmsServiceBroker.java
index 83b1919..0de6a03 100644
--- a/services/core/java/com/android/server/MmsServiceBroker.java
+++ b/services/core/java/com/android/server/MmsServiceBroker.java
@@ -35,7 +35,7 @@
 import android.os.RemoteException;
 import android.os.SystemClock;
 import android.os.UserHandle;
-import android.provider.Telephony;
+import android.service.carrier.CarrierMessagingService;
 import android.telephony.TelephonyManager;
 import android.util.Slog;
 
@@ -230,7 +230,7 @@
                 return;
             }
             contentUri = adjustUriForUserAndGrantPermission(contentUri,
-                    Telephony.Mms.Intents.MMS_SEND_ACTION,
+                    CarrierMessagingService.SERVICE_INTERFACE,
                     Intent.FLAG_GRANT_READ_URI_PERMISSION);
             getServiceGuarded().sendMessage(subId, callingPkg, contentUri, locationUrl,
                     configOverrides, sentIntent);
@@ -248,7 +248,7 @@
                 return;
             }
             contentUri = adjustUriForUserAndGrantPermission(contentUri,
-                    Telephony.Mms.Intents.MMS_DOWNLOAD_ACTION,
+                    CarrierMessagingService.SERVICE_INTERFACE,
                     Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
 
             getServiceGuarded().downloadMessage(subId, callingPkg, locationUrl, contentUri,
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 776f836..72c2eaf 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -620,7 +620,11 @@
             final int recordCount = mRecords.size();
             for (int i = 0; i < recordCount; i++) {
                 if (mRecords.get(i).binder == binder) {
-                    if (VDBG) log("remove: binder=" + binder);
+                    if (DBG) {
+                        Record r = mRecords.get(i);
+                        log("remove: binder=" + binder + "r.pkgForDebug" + r.pkgForDebug
+                                + "r.callback" + r.callback);
+                    }
                     mRecords.remove(i);
                     return;
                 }
@@ -954,7 +958,7 @@
                 + " state=" + state + " isDataConnectivityPossible=" + isDataConnectivityPossible
                 + " reason='" + reason
                 + "' apn='" + apn + "' apnType=" + apnType + " networkType=" + networkType
-                + " mRecords.size()=" + mRecords.size() + " mRecords=" + mRecords);
+                + " mRecords.size()=" + mRecords.size());
         }
         synchronized (mRecords) {
             int phoneId = SubscriptionManager.getPhoneId(subId);
@@ -1558,11 +1562,12 @@
     }
 
     boolean idMatch(int rSubId, int subId, int phoneId) {
+
+        if(subId < 0) {
+            // Invalid case, we need compare phoneId with default one.
+            return (mDefaultPhoneId == phoneId);
+        }
         if(rSubId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) {
-            if(subId < 0) {
-                // Invalid case, we need compare phoneId with default one.
-                return (mDefaultPhoneId == phoneId);
-            }
             return (subId == mDefaultSubId);
         } else {
             return (rSubId == subId);
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index efed0b9..9870a1a 100755
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -480,6 +480,10 @@
             }
             mStacks.remove(this);
             mStacks.add(this);
+            final TaskRecord task = topTask();
+            if (task != null) {
+                mWindowManager.moveTaskToTop(task.taskId);
+            }
         }
     }
 
@@ -3478,11 +3482,10 @@
             return;
         }
 
-        moveToFront();
-
         // Shift all activities with this task up to the top
         // of the stack, keeping them in the same internal order.
         insertTaskAtTop(tr);
+        moveToFront();
 
         if (DEBUG_TRANSITION) Slog.v(TAG, "Prepare to front transition: task=" + tr);
         if (reason != null &&
@@ -3497,8 +3500,6 @@
             updateTransitLocked(AppTransition.TRANSIT_TASK_TO_FRONT, options);
         }
 
-        mWindowManager.moveTaskToTop(tr.taskId);
-
         mStackSupervisor.resumeTopActivitiesLocked();
         EventLog.writeEvent(EventLogTags.AM_TASK_TO_FRONT, tr.userId, tr.taskId);
 
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 262b4f1..df5b3c5 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -2075,8 +2075,6 @@
             final TaskRecord topTask = targetStack.topTask();
             if (topTask != sourceTask) {
                 targetStack.moveTaskToFrontLocked(sourceTask, r, options);
-            } else {
-                mWindowManager.moveTaskToTop(topTask.taskId);
             }
             if (!addingToTask && (launchFlags&Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) {
                 // In this case, we are adding the activity to an existing
@@ -2131,8 +2129,6 @@
             }
             targetStack = inTask.stack;
             targetStack.moveTaskToFrontLocked(inTask, r, options);
-            targetStack.moveToFront();
-            mWindowManager.moveTaskToTop(inTask.taskId);
 
             // Check whether we should actually launch the new activity in to the task,
             // or just reuse the current activity on top.
diff --git a/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java b/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
index 779a834..f3e0bbc 100644
--- a/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
+++ b/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
@@ -53,7 +53,14 @@
     // default NetworkRequest in which case validation will not be attempted.
     // NOTE: This is a sticky bit; once set it is never cleared even if future validation attempts
     // fail.
-    public boolean validated;
+    public boolean everValidated;
+
+    // The result of the last validation attempt on this network (true if validated, false if not).
+    // This bit exists only because we never unvalidate a network once it's been validated, and that
+    // is because the network scoring and revalidation code does not (may not?) deal properly with
+    // networks becoming unvalidated.
+    // TODO: Fix the network scoring code, remove this, and rename everValidated to validated.
+    public boolean lastValidated;
 
     // This represents the last score received from the NetworkAgent.
     private int currentScore;
@@ -89,7 +96,8 @@
         networkMonitor = new NetworkMonitor(context, handler, this, defaultRequest);
         networkMisc = misc;
         created = false;
-        validated = false;
+        everValidated = false;
+        lastValidated = false;
     }
 
     public void addRequest(NetworkRequest networkRequest) {
@@ -114,7 +122,7 @@
 
         int score = currentScore;
 
-        if (!validated && !pretendValidated) score -= UNVALIDATED_SCORE_PENALTY;
+        if (!everValidated && !pretendValidated) score -= UNVALIDATED_SCORE_PENALTY;
         if (score < 0) score = 0;
 
         if (networkMisc.explicitlySelected) score = EXPLICITLY_SELECTED_NETWORK_SCORE;
@@ -142,8 +150,9 @@
         return "NetworkAgentInfo{ ni{" + networkInfo + "}  network{" +
                 network + "}  lp{" +
                 linkProperties + "}  nc{" +
-                networkCapabilities + "}  Score{" + getCurrentScore() + "} " +
-                "validated{" + validated + "} created{" + created + "} " +
+                networkCapabilities + "}  Score{" + getCurrentScore() + "}  " +
+                "everValidated{" + everValidated + "}  lastValidated{" + lastValidated + "}  " +
+                "created{" + created + "}  " +
                 "explicitlySelected{" + networkMisc.explicitlySelected + "} }";
     }
 
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecController.java b/services/core/java/com/android/server/hdmi/HdmiCecController.java
index 1486fee..55917fc 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecController.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecController.java
@@ -331,12 +331,13 @@
     /**
      * Configure ARC circuit in the hardware logic to start or stop the feature.
      *
+     * @param port ID of HDMI port to which AVR is connected
      * @param enabled whether to enable/disable ARC
      */
     @ServiceThreadOnly
-    void setAudioReturnChannel(boolean enabled) {
+    void setAudioReturnChannel(int port, boolean enabled) {
         assertRunOnServiceThread();
-        nativeSetAudioReturnChannel(mNativePtr, enabled);
+        nativeSetAudioReturnChannel(mNativePtr, port, enabled);
     }
 
     /**
@@ -633,6 +634,6 @@
     private static native int nativeGetVendorId(long controllerPtr);
     private static native HdmiPortInfo[] nativeGetPortInfos(long controllerPtr);
     private static native void nativeSetOption(long controllerPtr, int flag, int value);
-    private static native void nativeSetAudioReturnChannel(long controllerPtr, boolean flag);
+    private static native void nativeSetAudioReturnChannel(long controllerPtr, int port, boolean flag);
     private static native boolean nativeIsConnected(long controllerPtr, int port);
 }
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
index 62de534..e6990c6 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
@@ -827,7 +827,7 @@
         HdmiLogger.debug("Set Arc Status[old:%b new:%b]", mArcEstablished, enabled);
         boolean oldStatus = mArcEstablished;
         // 1. Enable/disable ARC circuit.
-        mService.setAudioReturnChannel(enabled);
+        mService.setAudioReturnChannel(getAvrDeviceInfo().getPortId(), enabled);
         // 2. Notify arc status to audio service.
         notifyArcStatusToAudioService(enabled);
         // 3. Update arc status;
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index 0322ae6..8ce6caf 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -756,8 +756,8 @@
         return dispatchMessageToLocalDevice(message);
     }
 
-    void setAudioReturnChannel(boolean enabled) {
-        mCecController.setAudioReturnChannel(enabled);
+    void setAudioReturnChannel(int portId, boolean enabled) {
+        mCecController.setAudioReturnChannel(portId, enabled);
     }
 
     @ServiceThreadOnly
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 650f0e2..825627f 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -927,7 +927,7 @@
                     Settings.Global.DEVICE_PROVISIONED, 0)) {
             mDisableNotificationEffects = true;
         }
-        mZenModeHelper.updateZenMode();
+        mZenModeHelper.readZenModeFromSetting();
 
         mUserProfiles.updateCache(getContext());
         listenForCallState();
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index 0f9a59b..841fc21 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -221,21 +221,26 @@
     }
 
     public void setZenMode(int zenMode, String reason) {
-        ZenLog.traceSetZenMode(zenMode, reason);
-        Global.putInt(mContext.getContentResolver(), Global.ZEN_MODE, zenMode);
+        setZenMode(zenMode, reason, true);
     }
 
-    public void updateZenMode() {
-        final int oldMode = mZenMode;
+    private void setZenMode(int zenMode, String reason, boolean setRingerMode) {
+        ZenLog.traceSetZenMode(zenMode, reason);
+        if (mZenMode == zenMode) return;
+        ZenLog.traceUpdateZenMode(mZenMode, zenMode);
+        mZenMode = zenMode;
+        Global.putInt(mContext.getContentResolver(), Global.ZEN_MODE, mZenMode);
+        if (setRingerMode) {
+            applyZenToRingerMode();
+        }
+        applyRestrictions();
+        mHandler.postDispatchOnZenModeChanged();
+    }
+
+    public void readZenModeFromSetting() {
         final int newMode = Global.getInt(mContext.getContentResolver(),
                 Global.ZEN_MODE, Global.ZEN_MODE_OFF);
-        if (oldMode != newMode) {
-            ZenLog.traceUpdateZenMode(oldMode, newMode);
-        }
-        mZenMode = newMode;
-        applyRestrictions();
-        onZenUpdated(oldMode, newMode);
-        dispatchOnZenModeChanged();
+        setZenMode(newMode, "setting");
     }
 
     private void applyRestrictions() {
@@ -297,18 +302,16 @@
         dispatchOnConfigChanged();
         final String val = Integer.toString(mConfig.hashCode());
         Global.putString(mContext.getContentResolver(), Global.ZEN_MODE_CONFIG_ETAG, val);
-        updateZenMode();
+        applyRestrictions();
         return true;
     }
 
-    private void onZenUpdated(int oldZen, int newZen) {
+    private void applyZenToRingerMode() {
         if (mAudioManager == null) return;
-        if (oldZen == newZen) return;
-
         // force the ringer mode into compliance
         final int ringerModeInternal = mAudioManager.getRingerModeInternal();
         int newRingerModeInternal = ringerModeInternal;
-        switch (newZen) {
+        switch (mZenMode) {
             case Global.ZEN_MODE_NO_INTERRUPTIONS:
                 if (ringerModeInternal != AudioManager.RINGER_MODE_SILENT) {
                     mPreviousRingerMode = ringerModeInternal;
@@ -337,7 +340,7 @@
         int ringerModeExternalOut = ringerModeNew;
 
         int newZen = -1;
-        switch(ringerModeNew) {
+        switch (ringerModeNew) {
             case AudioManager.RINGER_MODE_SILENT:
                 if (isChange) {
                     if (mZenMode != Global.ZEN_MODE_NO_INTERRUPTIONS) {
@@ -356,7 +359,7 @@
                 break;
         }
         if (newZen != -1) {
-            mHandler.postSetZenMode(newZen, "ringerModeInternal");
+            setZenMode(newZen, "ringerModeInternal", false /*setRingerMode*/);
         }
 
         if (isChange || newZen != -1 || ringerModeExternal != ringerModeExternalOut) {
@@ -374,7 +377,7 @@
         final boolean isVibrate = ringerModeInternal == AudioManager.RINGER_MODE_VIBRATE;
 
         int newZen = -1;
-        switch(ringerModeNew) {
+        switch (ringerModeNew) {
             case AudioManager.RINGER_MODE_SILENT:
                 if (isChange) {
                     if (mZenMode == Global.ZEN_MODE_OFF) {
@@ -394,7 +397,7 @@
                 break;
         }
         if (newZen != -1) {
-            mHandler.postSetZenMode(newZen, "ringerModeExternal");
+            setZenMode(newZen, "ringerModeExternal", false /*setRingerMode*/);
         }
 
         ZenLog.traceSetRingerModeExternal(ringerModeOld, ringerModeNew, caller, ringerModeInternal,
@@ -516,27 +519,28 @@
 
         public void update(Uri uri) {
             if (ZEN_MODE.equals(uri)) {
-                updateZenMode();
+                readZenModeFromSetting();
             }
         }
     }
 
     private class H extends Handler {
-        private static final int MSG_SET_ZEN = 1;
+        private static final int MSG_DISPATCH = 1;
 
         private H(Looper looper) {
             super(looper);
         }
 
-        private void postSetZenMode(int zen, String reason) {
-            obtainMessage(MSG_SET_ZEN, zen, 0, reason).sendToTarget();
+        private void postDispatchOnZenModeChanged() {
+            removeMessages(MSG_DISPATCH);
+            sendEmptyMessage(MSG_DISPATCH);
         }
 
         @Override
         public void handleMessage(Message msg) {
-            switch(msg.what) {
-                case MSG_SET_ZEN:
-                    setZenMode(msg.arg1, (String) msg.obj);
+            switch (msg.what) {
+                case MSG_DISPATCH:
+                    dispatchOnZenModeChanged();
                     break;
             }
         }
diff --git a/services/core/java/com/android/server/pm/BackgroundDexOptService.java b/services/core/java/com/android/server/pm/BackgroundDexOptService.java
index cb9a45e..7e66cd1 100644
--- a/services/core/java/com/android/server/pm/BackgroundDexOptService.java
+++ b/services/core/java/com/android/server/pm/BackgroundDexOptService.java
@@ -39,6 +39,11 @@
             "android",
             BackgroundDexOptService.class.getName());
 
+    /**
+     * Set of failed packages remembered across job runs.
+     */
+    static final ArraySet<String> sFailedPackageNames = new ArraySet<String>();
+
     final AtomicBoolean mIdleTime = new AtomicBoolean(false);
 
     public static void schedule(Context context) {
@@ -75,7 +80,15 @@
                         schedule(BackgroundDexOptService.this);
                         return;
                     }
-                    pm.performDexOpt(pkg, null /* instruction set */, true);
+                    if (sFailedPackageNames.contains(pkg)) {
+                        // skip previously failing package
+                        continue;
+                    }
+                    if (!pm.performDexOpt(pkg, null /* instruction set */, true)) {
+                        // there was a problem running dexopt,
+                        // remember this so we do not keep retrying.
+                        sFailedPackageNames.add(pkg);
+                    }
                 }
                 // ran to completion, so we abandon our timeslice and do not reschedule
                 jobFinished(jobParams, false);
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index 4d1ab4c..9786b42 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -2375,9 +2375,9 @@
             //
             // This preparation can take more than 20 seconds if
             // there's a very large update package, so lengthen the
-            // timeout.
+            // timeout.  We have seen 750MB packages take 3-4 minutes
             SystemProperties.set("ctl.start", "pre-recovery");
-            duration = 120 * 1000L;
+            duration = 300 * 1000L;
         } else {
             SystemProperties.set("sys.powerctl", "reboot," + reason);
             duration = 20 * 1000L;
diff --git a/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp b/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
index 5c557b6..a35af91 100644
--- a/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
+++ b/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
@@ -62,7 +62,7 @@
     // Set a flag and its value.
     void setOption(int flag, int value);
     // Set audio return channel status.
-    void setAudioReturnChannel(bool flag);
+    void setAudioReturnChannel(int port, bool flag);
     // Whether to hdmi device is connected to the given port.
     bool isConnected(int port);
 
@@ -260,8 +260,8 @@
 }
 
 // Set audio return channel status.
-void HdmiCecController::setAudioReturnChannel(bool enabled) {
-    mDevice->set_audio_return_channel(mDevice, enabled ? 1 : 0);
+  void HdmiCecController::setAudioReturnChannel(int port, bool enabled) {
+    mDevice->set_audio_return_channel(mDevice, port, enabled ? 1 : 0);
 }
 
 // Whether to hdmi device is connected to the given port.
@@ -374,9 +374,9 @@
 }
 
 static void nativeSetAudioReturnChannel(JNIEnv* env, jclass clazz, jlong controllerPtr,
-        jboolean enabled) {
+        jint port, jboolean enabled) {
     HdmiCecController* controller = reinterpret_cast<HdmiCecController*>(controllerPtr);
-    controller->setAudioReturnChannel(enabled == JNI_TRUE);
+    controller->setAudioReturnChannel(port, enabled == JNI_TRUE);
 }
 
 static jboolean nativeIsConnected(JNIEnv* env, jclass clazz, jlong controllerPtr, jint port) {
@@ -399,7 +399,7 @@
       "(J)[Landroid/hardware/hdmi/HdmiPortInfo;",
       (void *) nativeGetPortInfos },
     { "nativeSetOption", "(JII)V", (void *) nativeSetOption },
-    { "nativeSetAudioReturnChannel", "(JZ)V", (void *) nativeSetAudioReturnChannel },
+    { "nativeSetAudioReturnChannel", "(JIZ)V", (void *) nativeSetAudioReturnChannel },
     { "nativeIsConnected", "(JI)Z", (void *) nativeIsConnected },
 };
 
diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java
index 5371481..e764cd5 100644
--- a/telecomm/java/android/telecom/Conference.java
+++ b/telecomm/java/android/telecom/Conference.java
@@ -53,7 +53,7 @@
     private final List<Connection> mUnmodifiableConferenceableConnections =
             Collections.unmodifiableList(mConferenceableConnections);
 
-    private PhoneAccountHandle mPhoneAccount;
+    protected PhoneAccountHandle mPhoneAccount;
     private AudioState mAudioState;
     private int mState = Connection.STATE_NEW;
     private DisconnectCause mDisconnectCause;
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index f3b0586..a180f44 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -246,6 +246,7 @@
         public void onVideoStateChanged(Connection c, int videoState) {}
         public void onDisconnected(Connection c, DisconnectCause disconnectCause) {}
         public void onPostDialWait(Connection c, String remaining) {}
+        public void onPostDialChar(Connection c, char nextChar) {}
         public void onRingbackRequested(Connection c, boolean ringback) {}
         public void onDestroyed(Connection c) {}
         public void onConnectionCapabilitiesChanged(Connection c, int capabilities) {}
@@ -998,6 +999,23 @@
     }
 
     /**
+     * Informs listeners that this {@code Connection} has processed a character in the post-dial
+     * started state. This is done when (a) the {@code Connection} is issuing a DTMF sequence;
+     * (b) it has encountered a "wait" character; and (c) it wishes to signal Telecom to play
+     * the corresponding DTMF tone locally.
+     *
+     * @param nextChar The DTMF character that was just processed by the {@code Connection}.
+     *
+     * @hide
+     */
+    public final void setNextPostDialWaitChar(char nextChar) {
+        checkImmutable();
+        for (Listener l : mListeners) {
+            l.onPostDialChar(this, nextChar);
+        }
+    }
+
+    /**
      * Requests that the framework play a ringback tone. This is to be invoked by implementations
      * that do not play a ringback tone themselves in the connection's audio stream.
      *
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index d0a8aee..df16375 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -484,6 +484,13 @@
         }
 
         @Override
+        public void onPostDialChar(Connection c, char nextChar) {
+            String id = mIdByConnection.get(c);
+            Log.d(this, "Adapter onPostDialChar %s, %s", c, nextChar);
+            mAdapter.onPostDialChar(id, nextChar);
+        }
+
+        @Override
         public void onRingbackRequested(Connection c, boolean ringback) {
             String id = mIdByConnection.get(c);
             Log.d(this, "Adapter onRingback %b", ringback);
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
index aee9675..d026a28 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
@@ -226,6 +226,15 @@
         }
     }
 
+    void onPostDialChar(String callId, char nextChar) {
+        for (IConnectionServiceAdapter adapter : mAdapters) {
+            try {
+                adapter.onPostDialChar(callId, nextChar);
+            } catch (RemoteException ignored) {
+            }
+        }
+    }
+
     /**
      * Indicates that a new conference call has been created.
      *
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
index 7619da5..429f296 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
@@ -58,6 +58,7 @@
     private static final int MSG_SET_CALLER_DISPLAY_NAME = 19;
     private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20;
     private static final int MSG_ADD_EXISTING_CONNECTION = 21;
+    private static final int MSG_ON_POST_DIAL_CHAR = 22;
 
     private final IConnectionServiceAdapter mDelegate;
 
@@ -143,6 +144,15 @@
                     }
                     break;
                 }
+                case MSG_ON_POST_DIAL_CHAR: {
+                    SomeArgs args = (SomeArgs) msg.obj;
+                    try {
+                        mDelegate.onPostDialChar((String) args.arg1, (char) args.argi1);
+                    } finally {
+                        args.recycle();
+                    }
+                    break;
+                }
                 case MSG_QUERY_REMOTE_CALL_SERVICES:
                     mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) msg.obj);
                     break;
@@ -299,6 +309,14 @@
         }
 
         @Override
+        public void onPostDialChar(String connectionId, char nextChar) {
+            SomeArgs args = SomeArgs.obtain();
+            args.arg1 = connectionId;
+            args.argi1 = nextChar;
+            mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget();
+        }
+
+        @Override
         public void queryRemoteConnectionServices(RemoteServiceCallback callback) {
             mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, callback).sendToTarget();
         }
diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java
index 95cc387..486691f 100644
--- a/telecomm/java/android/telecom/RemoteConnection.java
+++ b/telecomm/java/android/telecom/RemoteConnection.java
@@ -101,6 +101,15 @@
         public void onPostDialWait(RemoteConnection connection, String remainingPostDialSequence) {}
 
         /**
+         * Invoked when the post-dial sequence in the outgoing {@code Connection} has processed
+         * a character.
+         *
+         * @param connection The {@code RemoteConnection} invoking this method.
+         * @param nextChar The character being processed.
+         */
+        public void onPostDialChar(RemoteConnection connection, char nextChar) {}
+
+        /**
          * Indicates that the VOIP audio status of this {@code RemoteConnection} has changed.
          * See {@link #isVoipAudioMode()}.
          *
@@ -726,7 +735,7 @@
      * of time.
      *
      * If the DTMF string contains a {@link TelecomManager#DTMF_CHARACTER_WAIT} symbol, this
-     * {@code RemoteConnection} will pause playing the tones and notify callbackss via
+     * {@code RemoteConnection} will pause playing the tones and notify callbacks via
      * {@link Callback#onPostDialWait(RemoteConnection, String)}. At this point, the in-call app
      * should display to the user an indication of this state and an affordance to continue
      * the postdial sequence. When the user decides to continue the postdial sequence, the in-call
@@ -869,6 +878,15 @@
     /**
      * @hide
      */
+    void onPostDialChar(char nextChar) {
+        for (Callback c : mCallbacks) {
+            c.onPostDialChar(this, nextChar);
+        }
+    }
+
+    /**
+     * @hide
+     */
     void setVideoState(int videoState) {
         mVideoState = videoState;
         for (Callback c : mCallbacks) {
diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java
index 906ecaa..073dcd5 100644
--- a/telecomm/java/android/telecom/RemoteConnectionService.java
+++ b/telecomm/java/android/telecom/RemoteConnectionService.java
@@ -223,6 +223,12 @@
         }
 
         @Override
+        public void onPostDialChar(String callId, char nextChar) {
+            findConnectionForAction(callId, "onPostDialChar")
+                    .onPostDialChar(nextChar);
+        }
+
+        @Override
         public void queryRemoteConnectionServices(RemoteServiceCallback callback) {
             // Not supported from remote connection service.
         }
diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
index 4517a96..7e7e9cc 100644
--- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
@@ -62,6 +62,8 @@
 
     void onPostDialWait(String callId, String remaining);
 
+    void onPostDialChar(String callId, char nextChar);
+
     void queryRemoteConnectionServices(RemoteServiceCallback callback);
 
     void setVideoProvider(String callId, IVideoProvider videoProvider);
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index 4ff6389..ba07a95 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -1503,7 +1503,7 @@
             int digit = Character.digit(c, 10);
             if (digit != -1) {
                 sb.append(digit);
-            } else if (i == 0 && c == '+') {
+            } else if (sb.length() == 0 && c == '+') {
                 sb.append(c);
             } else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
                 return normalizeNumber(PhoneNumberUtils.convertKeypadLettersToDigits(phoneNumber));
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index d0ddeac..c421800 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -3639,6 +3639,8 @@
         } catch (SettingNotFoundException e) {
             try {
                 int val = Settings.Global.getInt(cr, name);
+                Settings.Global.putInt(cr, name + subId, val);
+
                 /* We are now moving from 'setting' to 'setting+subId', and using the value stored
                  * for 'setting' as default. Reset the default (since it may have a user set
                  * value). */
diff --git a/telephony/java/com/android/ims/ImsReasonInfo.java b/telephony/java/com/android/ims/ImsReasonInfo.java
index 2482249..0b1246b 100644
--- a/telephony/java/com/android/ims/ImsReasonInfo.java
+++ b/telephony/java/com/android/ims/ImsReasonInfo.java
@@ -228,6 +228,13 @@
      */
     public static final int CODE_ECBM_NOT_SUPPORTED = 901;
 
+    /**
+     * Network string error messages.
+     * mExtraMessage may have these values.
+     */
+    public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED
+            = "Forbidden. Not Authorized for Service";
+
     // For reason type
     public int mReasonType;
     // For main reason code
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index c67e5d7..92cd468 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
@@ -274,6 +274,15 @@
     public static final String ACTION_CARRIER_SETUP = "android.intent.action.ACTION_CARRIER_SETUP";
 
     /**
+     * <p>Broadcast Action: Indicates that the action is forbidden by network.
+     * <p class="note">
+     * This is for the OEM applications to understand about possible provisioning issues.
+     * Used in OMA-DM applications.
+     */
+    public static final String ACTION_FORBIDDEN_NO_SERVICE_AUTHORIZATION
+            = "android.intent.action.ACTION_FORBIDDEN_NO_SERVICE_AUTHORIZATION";
+
+    /**
      * Broadcast Action: A "secret code" has been entered in the dialer. Secret codes are
      * of the form {@code *#*#<code>#*#*}. The intent will have the data URI:
      *
diff --git a/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_dot_left.xml b/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_dot_left.xml
deleted file mode 100644
index b465ead..0000000
--- a/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_dot_left.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="scaleX"
-            android:valueFrom="1"
-            android:valueTo="1"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="350"
-            android:propertyName="scaleX"
-            android:valueFrom="1"
-            android:valueTo="0"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="scaleY"
-            android:valueFrom="1"
-            android:valueTo="1"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="350"
-            android:propertyName="scaleY"
-            android:valueFrom="1"
-            android:valueTo="0"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="rotation"
-            android:valueFrom="0"
-            android:valueTo="0"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="350"
-            android:propertyName="rotation"
-            android:valueFrom="0"
-            android:valueTo="-45"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-</set>
diff --git a/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_dot_right.xml b/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_dot_right.xml
deleted file mode 100644
index 49ac165..0000000
--- a/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_dot_right.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="scaleX"
-            android:valueFrom="1"
-            android:valueTo="1"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="350"
-            android:propertyName="scaleX"
-            android:valueFrom="1"
-            android:valueTo="0"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="scaleY"
-            android:valueFrom="1"
-            android:valueTo="1"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="350"
-            android:propertyName="scaleY"
-            android:valueFrom="1"
-            android:valueTo="0"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="rotation"
-            android:valueFrom="0"
-            android:valueTo="0"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="350"
-            android:propertyName="rotation"
-            android:valueFrom="0"
-            android:valueTo="45"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-</set>
diff --git a/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_ic_signal_wifi_4_bar_48px_outlines_.xml b/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_ic_signal_wifi_4_bar_48px_outlines_.xml
deleted file mode 100644
index 1bdfde6..0000000
--- a/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_ic_signal_wifi_4_bar_48px_outlines_.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="alpha"
-            android:valueFrom="1"
-            android:valueTo="1"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="350"
-            android:propertyName="alpha"
-            android:valueFrom="1"
-            android:valueTo="0.5"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-</set>
diff --git a/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_mask.xml b/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_mask.xml
deleted file mode 100644
index 47efa18..0000000
--- a/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_mask.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="pathData"
-            android:valueFrom="M 37.8337860107 -40.4599914551 c 0.0 0.0 -35.8077850342 30.0523681641 -35.8077850342 30.0523681641 c 0.0 0.0 12.925994873 12.9778747559 12.925994873 12.9778747559 c 0.0 0.0 -2.61700439453 2.09387207031 -2.61700439453 2.09387207031 c 0.0 0.0 -13.1259613037 -12.9893035889 -13.1259613037 -12.9893035889 c 0.0 0.0 -34.6200408936 26.9699249268 -34.6200408936 26.9699249268 c 0.0 0.0 55.9664764404 69.742401123 55.9664764404 69.742401123 c 0.0 0.0 73.2448120117 -59.1047973633 73.2448120117 -59.1047973633 c 0.0 0.0 -55.9664916992 -69.7423400879 -55.9664916992 -69.7423400879 Z"
-            android:valueTo="M 37.8337860107 -40.4599914551 c 0.0 0.0 -35.8077850342 30.0523681641 -35.8077850342 30.0523681641 c 0.0 0.0 12.925994873 12.9778747559 12.925994873 12.9778747559 c 0.0 0.0 -2.61700439453 2.09387207031 -2.61700439453 2.09387207031 c 0.0 0.0 -13.1259613037 -12.9893035889 -13.1259613037 -12.9893035889 c 0.0 0.0 -34.6200408936 26.9699249268 -34.6200408936 26.9699249268 c 0.0 0.0 55.9664764404 69.742401123 55.9664764404 69.742401123 c 0.0 0.0 73.2448120117 -59.1047973633 73.2448120117 -59.1047973633 c 0.0 0.0 -55.9664916992 -69.7423400879 -55.9664916992 -69.7423400879 Z"
-            android:valueType="pathType"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="133"
-            android:propertyName="pathData"
-            android:valueFrom="M 37.8337860107 -40.4599914551 c 0.0 0.0 -35.8077850342 30.0523681641 -35.8077850342 30.0523681641 c 0.0 0.0 12.925994873 12.9778747559 12.925994873 12.9778747559 c 0.0 0.0 -2.61700439453 2.09387207031 -2.61700439453 2.09387207031 c 0.0 0.0 -13.1259613037 -12.9893035889 -13.1259613037 -12.9893035889 c 0.0 0.0 -34.6200408936 26.9699249268 -34.6200408936 26.9699249268 c 0.0 0.0 55.9664764404 69.742401123 55.9664764404 69.742401123 c 0.0 0.0 73.2448120117 -59.1047973633 73.2448120117 -59.1047973633 c 0.0 0.0 -55.9664916992 -69.7423400879 -55.9664916992 -69.7423400879 Z"
-            android:valueTo="M 37.8337860107 -40.4599914551 c 0.0 0.0 -35.8077850342 29.7398681641 -35.8077850342 29.7398681641 c 0.0 0.0 27.2634735107 27.4966583252 27.2634735107 27.4966583252 c 0.0 0.0 -2.61700439453 2.4063873291 -2.61700439453 2.4063873291 c 0.0 0.0 -27.4634399414 -27.508102417 -27.4634399414 -27.508102417 c 0.0 0.0 -34.6200408936 26.9699249268 -34.6200408936 26.9699249268 c 0.0 0.0 55.9664764404 69.742401123 55.9664764404 69.742401123 c 0.0 0.0 73.2448120117 -59.1047973633 73.2448120117 -59.1047973633 c 0.0 0.0 -55.9664916992 -69.7423400879 -55.9664916992 -69.7423400879 Z"
-            android:valueType="pathType"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-</set>
diff --git a/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_path_1.xml b/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_path_1.xml
deleted file mode 100644
index 41fe866..0000000
--- a/tests/VectorDrawableTest/res/anim/ic_bluethooth_v2_animation_path_1.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="pathData"
-            android:valueFrom="M 10.6188659668 6.56344604492 c 0.0 0.0 21.7386016846 23.1297454834 21.7386016846 23.1297454834 "
-            android:valueTo="M 10.6188659668 6.56344604492 c 0.0 0.0 21.7386016846 23.1297454834 21.7386016846 23.1297454834 "
-            android:valueType="pathType"
-            android:interpolator="@interpolator/ic_bluethooth_v2_path_1_pathdata_interpolator" />
-        <objectAnimator
-            android:duration="350"
-            android:propertyName="pathData"
-            android:valueFrom="M 10.6188659668 6.56344604492 c 0.0 0.0 21.7386016846 23.1297454834 21.7386016846 23.1297454834 "
-            android:valueTo="M 8.62858581543 4.33430480957 c 0.0 0.0 28.1998138428 30.2359008789 28.1998138428 30.2359008789 "
-            android:valueType="pathType"
-            android:interpolator="@interpolator/ic_bluethooth_v2_path_1_pathdata_interpolator" />
-    </set>
-</set>
diff --git a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_frame.xml b/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_frame.xml
deleted file mode 100644
index 9cea85d..0000000
--- a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_frame.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="367"
-            android:propertyName="alpha"
-            android:valueFrom="0.5"
-            android:valueTo="0.5"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="333"
-            android:propertyName="alpha"
-            android:valueFrom="0.5"
-            android:valueTo="1"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-</set>
diff --git a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_screen.xml b/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_screen.xml
deleted file mode 100644
index 61b018b..0000000
--- a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_screen.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="367"
-            android:propertyName="alpha"
-            android:valueFrom="0"
-            android:valueTo="0"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="333"
-            android:propertyName="alpha"
-            android:valueFrom="0"
-            android:valueTo="1"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-</set>
diff --git a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave1.xml b/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave1.xml
deleted file mode 100644
index 002f7b2..0000000
--- a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave1.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="pathData"
-            android:valueFrom="M 0 -4.0 a 4 4 0 0 1 4 4 a 4 4 0 0 1 -4 4 a 4 4 0 0 1 -4 -4 a 4 4 0 0 1 4 -4 Z"
-            android:valueTo="M 0 -4.0 a 4 4 0 0 1 4 4 a 4 4 0 0 1 -4 4 a 4 4 0 0 1 -4 -4 a 4 4 0 0 1 4 -4 Z"
-            android:valueType="pathType"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="500"
-            android:propertyName="pathData"
-            android:valueFrom="M 0 -4.0 a 4 4 0 0 1 4 4 a 4 4 0 0 1 -4 4 a 4 4 0 0 1 -4 -4 a 4 4 0 0 1 4 -4 Z"
-            android:valueTo="M 0 -20.0 a 20 20 0 0 1 20 20 a 20 20 0 0 1 -20 20 a 20 20 0 0 1 -20 -20 a 20 20 0 0 1 20 -20 Z"
-            android:valueType="pathType"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-</set>
diff --git a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave2.xml b/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave2.xml
deleted file mode 100644
index 0c2ee21..0000000
--- a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave2.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="pathData"
-            android:valueFrom="M 0 -12.0 a 12 12 0 0 1 12 12 a 12 12 0 0 1 -12 12 a 12 12 0 0 1 -12 -12 a 12 12 0 0 1 12 -12 Z"
-            android:valueTo="M 0 -12.0 a 12 12 0 0 1 12 12 a 12 12 0 0 1 -12 12 a 12 12 0 0 1 -12 -12 a 12 12 0 0 1 12 -12 Z"
-            android:valueType="pathType"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="333"
-            android:propertyName="pathData"
-            android:valueFrom="M 0 -12.0 a 12 12 0 0 1 12 12 a 12 12 0 0 1 -12 12 a 12 12 0 0 1 -12 -12 a 12 12 0 0 1 12 -12 Z"
-            android:valueTo="M 0 -20.0 a 20 20 0 0 1 20 20 a 20 20 0 0 1 -20 20 a 20 20 0 0 1 -20 -20 a 20 20 0 0 1 20 -20 Z"
-            android:valueType="pathType"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-</set>
diff --git a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave3.xml b/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave3.xml
deleted file mode 100644
index a75b2eaf..0000000
--- a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave3.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="pathData"
-            android:valueFrom="M 0 -20.0 a 20 20 0 0 1 20 20 a 20 20 0 0 1 -20 20 a 20 20 0 0 1 -20 -20 a 20 20 0 0 1 20 -20 Z"
-            android:valueTo="M 0 -20.0 a 20 20 0 0 1 20 20 a 20 20 0 0 1 -20 20 a 20 20 0 0 1 -20 -20 a 20 20 0 0 1 20 -20 Z"
-            android:valueType="pathType"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="167"
-            android:propertyName="pathData"
-            android:valueFrom="M 0 -20.0 a 20 20 0 0 1 20 20 a 20 20 0 0 1 -20 20 a 20 20 0 0 1 -20 -20 a 20 20 0 0 1 20 -20 Z"
-            android:valueTo="M 0 -20.0 a 20 20 0 0 1 20 20 a 20 20 0 0 1 -20 20 a 20 20 0 0 1 -20 -20 a 20 20 0 0 1 20 -20 Z"
-            android:valueType="pathType"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-</set>
diff --git a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave5.xml b/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave5.xml
deleted file mode 100644
index 7e79b94..0000000
--- a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave5.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="pathData"
-            android:valueFrom="M 0 -0.0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 Z"
-            android:valueTo="M 0 -0.0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 Z"
-            android:valueType="pathType"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="500"
-            android:propertyName="pathData"
-            android:valueFrom="M 0 -0.0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 Z"
-            android:valueTo="M 0 -12.0 a 12 12 0 0 1 12 12 a 12 12 0 0 1 -12 12 a 12 12 0 0 1 -12 -12 a 12 12 0 0 1 12 -12 Z"
-            android:valueType="pathType"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-</set>
diff --git a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave6.xml b/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave6.xml
deleted file mode 100644
index 0917e0e..0000000
--- a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_wave6.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="200"
-            android:propertyName="pathData"
-            android:valueFrom="M 0 -0.0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 Z"
-            android:valueTo="M 0 -0.0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 Z"
-            android:valueType="pathType"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="333"
-            android:propertyName="pathData"
-            android:valueFrom="M 0 -0.0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 Z"
-            android:valueTo="M 0 -4.0 a 4 4 0 0 1 4 4 a 4 4 0 0 1 -4 4 a 4 4 0 0 1 -4 -4 a 4 4 0 0 1 4 -4 Z"
-            android:valueType="pathType"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-</set>
diff --git a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_waves.xml b/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_waves.xml
deleted file mode 100644
index 9cea85d..0000000
--- a/tests/VectorDrawableTest/res/anim/ic_cast_v2_animation_waves.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-    <set
-        android:ordering="sequentially" >
-        <objectAnimator
-            android:duration="367"
-            android:propertyName="alpha"
-            android:valueFrom="0.5"
-            android:valueTo="0.5"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-        <objectAnimator
-            android:duration="333"
-            android:propertyName="alpha"
-            android:valueFrom="0.5"
-            android:valueTo="1"
-            android:interpolator="@android:interpolator/fast_out_slow_in" />
-    </set>
-</set>
diff --git a/tests/VectorDrawableTest/res/drawable/ic_bluethooth_v2.xml b/tests/VectorDrawableTest/res/drawable/ic_bluethooth_v2.xml
deleted file mode 100644
index 5f068fc..0000000
--- a/tests/VectorDrawableTest/res/drawable/ic_bluethooth_v2.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:height="48dp"
-    android:width="48dp"
-    android:viewportHeight="48"
-    android:viewportWidth="48"
-    android:name="root_bt">
-    <group
-        android:name="ic_signal_wifi_4_bar_48px_outlines_"
-        android:translateX="21.9995"
-        android:translateY="25.73401" >
-        <group
-            android:name="ic_signal_wifi_4_bar_48px_outlines__pivot"
-            android:translateX="-23.21545"
-            android:translateY="-18.86649" >
-            <clip-path
-                android:name="mask"
-                android:pathData="M 37.8337860107 -40.4599914551 c 0.0 0.0 -35.8077850342 30.0523681641 -35.8077850342 30.0523681641 c 0.0 0.0 12.925994873 12.9778747559 12.925994873 12.9778747559 c 0.0 0.0 -2.61700439453 2.09387207031 -2.61700439453 2.09387207031 c 0.0 0.0 -13.1259613037 -12.9893035889 -13.1259613037 -12.9893035889 c 0.0 0.0 -34.6200408936 26.9699249268 -34.6200408936 26.9699249268 c 0.0 0.0 55.9664764404 69.742401123 55.9664764404 69.742401123 c 0.0 0.0 73.2448120117 -59.1047973633 73.2448120117 -59.1047973633 c 0.0 0.0 -55.9664916992 -69.7423400879 -55.9664916992 -69.7423400879 Z" />
-            <group
-                android:name="cross"
-                android:rotation="-1.88453332239" >
-                <path
-                    android:name="path_1"
-                    android:pathData="M 10.6188659668 6.56344604492 c 0.0 0.0 21.7386016846 23.1297454834 21.7386016846 23.1297454834 "
-                    android:strokeColor="#FF777777"
-                    android:strokeWidth="4"
-                    android:fillColor="#00000000" />
-            </group>
-            <group
-                android:name="bluetooth"
-                android:translateX="23.38789"
-                android:translateY="18.72031" >
-                <path
-                    android:name="path_4"
-                    android:pathData="M 11.3999938965 -8.60000610352 c 0.0 0.0 -11.3999938965 -11.3999938965 -11.3999938965 -11.3999938965 c 0 0 -2 0 -2 0 c 0 0 0 15.1999969482 0 15.1999969482 c 0 0.0 -9.19999694824 -9.19999694824 -9.19999694824 -9.19999694824 c 0.0 0 -2.80000305176 2.80000305176 -2.80000305176 2.80000305176 c 0 0.0 11.1999969482 11.1999969482 11.1999969482 11.1999969482 c 0.0 0 -11.1999969482 11.1999969482 -11.1999969482 11.1999969482 c 0 0.0 2.80000305176 2.80000305176 2.80000305176 2.80000305176 c 0.0 0 9.19999694824 -9.19999694824 9.19999694824 -9.19999694824 c 0 0.0 0 15.1999969482 0 15.1999969482 c 0 0 2 0 2 0 c 0 0 11.3999938965 -11.3999938965 11.3999938965 -11.3999938965 c 0.0 0.0 -8.59999084473 -8.60000610352 -8.59999084473 -8.60000610352 c 0.0 0 8.59999084473 -8.60000610352 8.59999084473 -8.60000610352 Z M 2 -12.3000030518 c 0 0.0 3.80000305176 3.80000305176 3.80000305176 3.80000305176 c 0.0 0.0 -3.80000305176 3.69999694824 -3.80000305176 3.69999694824 c 0 0.0 0 -7.5 0 -7.5 Z M 5.80000305176 8.60000610352 c 0.0 0.0 -3.80000305176 3.69999694824 -3.80000305176 3.69999694824 c 0 0.0 0 -7.5 0 -7.5 c 0 0.0 3.80000305176 3.80000305176 3.80000305176 3.80000305176 Z"
-                    android:fillColor="#FF777777" />
-            </group>
-            <group
-                android:name="dot_left"
-                android:translateX="20.16992"
-                android:translateY="18.64258" >
-                <group
-                    android:name="dot_left_pivot"
-                    android:translateX="-20.16992"
-                    android:translateY="-18.64258" >
-                    <path
-                        android:name="dot_left_1"
-                        android:pathData="M 13.3878936768 18.7203063965 c 0.0 0.0 -4.0 -4.0 -4.0 -4.0 c 0.0 0.0 -4.0 4.0 -4.0 4.0 c 0.0 0.0 4.0 4.0 4.0 4.0 c 0.0 0.0 4.0 -4.0 4.0 -4.0 Z"
-                        android:fillColor="#FF777777" />
-                </group>
-            </group>
-            <group
-                android:name="dot_right"
-                android:translateX="26.16094"
-                android:translateY="18.60898" >
-                <group
-                    android:name="dot_right_pivot"
-                    android:translateX="-26.16094"
-                    android:translateY="-18.60898" >
-                    <path
-                        android:name="dot_right_1"
-                        android:pathData="M 37.3878936768 14.7203063965 c 0.0 0.0 -4.0 4.0 -4.0 4.0 c 0.0 0.0 4.0 4.0 4.0 4.0 c 0.0 0.0 4.0 -4.0 4.0 -4.0 c 0.0 0.0 -4.0 -4.0 -4.0 -4.0 Z"
-                        android:fillColor="#FF777777" />
-                </group>
-            </group>
-        </group>
-    </group>
-</vector>
diff --git a/tests/VectorDrawableTest/res/drawable/ic_bluethooth_v2_animation.xml b/tests/VectorDrawableTest/res/drawable/ic_bluethooth_v2_animation.xml
deleted file mode 100644
index aa05468..0000000
--- a/tests/VectorDrawableTest/res/drawable/ic_bluethooth_v2_animation.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:drawable="@drawable/ic_bluethooth_v2" >
-    <target
-        android:name="root_bt"
-        android:animation="@anim/ic_bluethooth_v2_animation_ic_signal_wifi_4_bar_48px_outlines_" />
-    <target
-        android:name="mask"
-        android:animation="@anim/ic_bluethooth_v2_animation_mask" />
-    <target
-        android:name="path_1"
-        android:animation="@anim/ic_bluethooth_v2_animation_path_1" />
-    <target
-        android:name="dot_left"
-        android:animation="@anim/ic_bluethooth_v2_animation_dot_left" />
-    <target
-        android:name="dot_right"
-        android:animation="@anim/ic_bluethooth_v2_animation_dot_right" />
-</animated-vector>
diff --git a/tests/VectorDrawableTest/res/drawable/ic_cast_v2.xml b/tests/VectorDrawableTest/res/drawable/ic_cast_v2.xml
deleted file mode 100644
index 207804a..0000000
--- a/tests/VectorDrawableTest/res/drawable/ic_cast_v2.xml
+++ /dev/null
@@ -1,123 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:height="48dp"
-    android:width="48dp"
-    android:viewportHeight="48"
-    android:viewportWidth="48" >
-    <group
-        android:name="ic_cast_connected_48px_outlines"
-        android:translateX="24"
-        android:translateY="24" >
-        <group
-            android:name="ic_cast_connected_48px_outlines_pivot"
-            android:translateX="-24"
-            android:translateY="-24" >
-            <clip-path
-                android:name="mask_1"
-                android:pathData="M 46.6999969482 3.80000305176 c 0.0 0.0 -44.6999664307 0.0 -44.6999664307 0.0 c 0.0 0.0 0.29997253418 38.25 0.29997253418 38.25 c 0.0 0.0 44.8000030518 -0.100021362305 44.8000030518 -0.100021362305 c 0.0 0.0 -0.400009155273 -38.1499786377 -0.400009155273 -38.1499786377 Z" />
-            <group
-                android:name="waves"
-                android:alpha="0.5" >
-                <group
-                    android:name="wave1_position"
-                    android:translateX="2"
-                    android:translateY="42" >
-                    <path
-                        android:name="wave1"
-                        android:pathData="M 0 -4.0 a 4 4 0 0 1 4 4 a 4 4 0 0 1 -4 4 a 4 4 0 0 1 -4 -4 a 4 4 0 0 1 4 -4 Z"
-                        android:strokeColor="#FF777777"
-                        android:strokeWidth="4"
-                        android:fillColor="#00000000" />
-                </group>
-                <group
-                    android:name="wave2_position"
-                    android:translateX="2"
-                    android:translateY="42" >
-                    <path
-                        android:name="wave2"
-                        android:pathData="M 0 -12.0 a 12 12 0 0 1 12 12 a 12 12 0 0 1 -12 12 a 12 12 0 0 1 -12 -12 a 12 12 0 0 1 12 -12 Z"
-                        android:strokeColor="#FF777777"
-                        android:strokeWidth="4"
-                        android:fillColor="#00000000" />
-                </group>
-                <group
-                    android:name="wave3_position"
-                    android:translateX="2"
-                    android:translateY="42" >
-                    <path
-                        android:name="wave3"
-                        android:pathData="M 0 -20.0 a 20 20 0 0 1 20 20 a 20 20 0 0 1 -20 20 a 20 20 0 0 1 -20 -20 a 20 20 0 0 1 20 -20 Z"
-                        android:strokeColor="#FF777777"
-                        android:strokeWidth="4"
-                        android:fillColor="#00000000" />
-                </group>
-                <group
-                    android:name="wave5_position"
-                    android:translateX="2"
-                    android:translateY="42" >
-                    <path
-                        android:name="wave5"
-                        android:pathData="M 0 -0.0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 Z"
-                        android:strokeColor="#FF777777"
-                        android:strokeWidth="4"
-                        android:fillColor="#00000000" />
-                </group>
-                <group
-                    android:name="wave6_position"
-                    android:translateX="2"
-                    android:translateY="42" >
-                    <path
-                        android:name="wave6"
-                        android:pathData="M 0 -0.0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 a 0 0 0 0 1 0 0 Z"
-                        android:strokeColor="#FF777777"
-                        android:strokeWidth="4"
-                        android:fillColor="#00000000" />
-                </group>
-                <group
-                    android:name="ellipse_path_1_position"
-                    android:translateX="2"
-                    android:translateY="42" >
-                    <path
-                        android:name="ellipse_path_1"
-                        android:pathData="M 0 -2.0 a 2 2 0 0 1 2 2 a 2 2 0 0 1 -2 2 a 2 2 0 0 1 -2 -2 a 2 2 0 0 1 2 -2 Z"
-                        android:strokeColor="#FF777777"
-                        android:strokeWidth="4"
-                        android:fillColor="#00000000" />
-                </group>
-            </group>
-            <group
-                android:name="screen"
-                android:translateX="24"
-                android:translateY="24"
-                android:alpha="0" >
-                <path
-                    android:name="screen_1"
-                    android:pathData="M 14 -10 c 0 0 -28 0 -28 0 c 0 0 0 3.30000305176 0 3.30000305176 c 7.89999389648 2.59999084473 14.1999969482 8.80000305176 16.6999969482 16.6999969482 c 0.0 0 11.3000030518 0 11.3000030518 0 c 0 0 0 -20 0 -20 Z"
-                    android:fillColor="#FF777777" />
-            </group>
-            <group
-                android:name="frame"
-                android:translateX="24"
-                android:translateY="24"
-                android:alpha="0.5" >
-                <path
-                    android:name="box"
-                    android:pathData="M 18 -18 c 0 0 -36 0 -36 0 c -2.19999694824 0 -4 1.80000305176 -4 4 c 0 0 0 6 0 6 c 0 0 4 0 4 0 c 0 0 0 -6 0 -6 c 0 0 36 0 36 0 c 0 0 0 28 0 28 c 0 0 -14 0 -14 0 c 0 0 0 4 0 4 c 0 0 14 0 14 0 c 2.19999694824 0 4 -1.80000305176 4 -4 c 0 0 0 -28 0 -28 c 0 -2.19999694824 -1.80000305176 -4 -4 -4 Z"
-                    android:fillColor="#FF777777" />
-            </group>
-        </group>
-    </group>
-</vector>
diff --git a/tests/VectorDrawableTest/res/drawable/ic_cast_v2_animation.xml b/tests/VectorDrawableTest/res/drawable/ic_cast_v2_animation.xml
deleted file mode 100644
index 7884212..0000000
--- a/tests/VectorDrawableTest/res/drawable/ic_cast_v2_animation.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:drawable="@drawable/ic_cast_v2" >
-    <target
-        android:name="waves"
-        android:animation="@anim/ic_cast_v2_animation_waves" />
-    <target
-        android:name="wave1"
-        android:animation="@anim/ic_cast_v2_animation_wave1" />
-    <target
-        android:name="wave2"
-        android:animation="@anim/ic_cast_v2_animation_wave2" />
-    <target
-        android:name="wave3"
-        android:animation="@anim/ic_cast_v2_animation_wave3" />
-    <target
-        android:name="wave5"
-        android:animation="@anim/ic_cast_v2_animation_wave5" />
-    <target
-        android:name="wave6"
-        android:animation="@anim/ic_cast_v2_animation_wave6" />
-    <target
-        android:name="screen"
-        android:animation="@anim/ic_cast_v2_animation_screen" />
-    <target
-        android:name="frame"
-        android:animation="@anim/ic_cast_v2_animation_frame" />
-</animated-vector>
diff --git a/tests/VectorDrawableTest/res/interpolator/ic_bluethooth_v2_path_1_pathdata_interpolator.xml b/tests/VectorDrawableTest/res/interpolator/ic_bluethooth_v2_path_1_pathdata_interpolator.xml
deleted file mode 100644
index 4917f77..0000000
--- a/tests/VectorDrawableTest/res/interpolator/ic_bluethooth_v2_path_1_pathdata_interpolator.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<!-- Copyright (C) 2014 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.
--->
-<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
-    android:pathData="M 0 0 c 0.16666666667 0.0 0.2 1.0 1.0 1.0" />
diff --git a/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java b/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java
index c4dfb84..ecc7782 100644
--- a/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java
+++ b/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java
@@ -29,8 +29,6 @@
             R.drawable.ic_rotate_2_portrait_v2_animation,
             R.drawable.ic_signal_airplane_v2_animation,
             R.drawable.ic_hourglass_animation,
-            R.drawable.ic_cast_v2_animation,
-            R.drawable.ic_bluethooth_v2_animation,
             R.drawable.animation_vector_linear_progress_bar,
             R.drawable.animation_vector_drawable_grouping_1,
             R.drawable.animation_vector_progress_bar,
diff --git a/tools/aapt/Bundle.h b/tools/aapt/Bundle.h
index 0e130f4..e7cde74 100644
--- a/tools/aapt/Bundle.h
+++ b/tools/aapt/Bundle.h
@@ -179,6 +179,8 @@
     void setVersionName(const char* val) { mVersionName = val; }
     bool getReplaceVersion() { return mReplaceVersion; }
     void setReplaceVersion(bool val) { mReplaceVersion = val; }
+    const android::String8& getRevisionCode() { return mRevisionCode; }
+    void setRevisionCode(const char* val) { mRevisionCode = android::String8(val); }
     const char* getCustomPackage() const { return mCustomPackage; }
     void setCustomPackage(const char* val) { mCustomPackage = val; }
     const char* getExtraPackages() const { return mExtraPackages; }
@@ -297,6 +299,7 @@
 
     android::String8 mFeatureOfPackage;
     android::String8 mFeatureAfterPackage;
+    android::String8 mRevisionCode;
     const char* mManifestMinSdkVersion;
     const char* mMinSdkVersion;
     const char* mTargetSdkVersion;
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index e3a0200..e2e83e4 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -257,6 +257,11 @@
 
     assets->setPackage(String8(block.getAttributeStringValue(nameIndex, &len)));
 
+    ssize_t revisionCodeIndex = block.indexOfAttribute(RESOURCES_ANDROID_NAMESPACE, "revisionCode");
+    if (revisionCodeIndex >= 0) {
+        bundle->setRevisionCode(String8(block.getAttributeStringValue(revisionCodeIndex, &len)).string());
+    }
+
     String16 uses_sdk16("uses-sdk");
     while ((code=block.next()) != ResXMLTree::END_DOCUMENT
            && code != ResXMLTree::BAD_DOCUMENT) {
@@ -1075,6 +1080,14 @@
         return UNKNOWN_ERROR;
     }
 
+    // Add the 'revisionCode' attribute, which is set to the original revisionCode.
+    if (bundle->getRevisionCode().size() > 0) {
+        if (!addTagAttribute(manifest, RESOURCES_ANDROID_NAMESPACE, "revisionCode",
+                    bundle->getRevisionCode().string(), true, true)) {
+            return UNKNOWN_ERROR;
+        }
+    }
+
     // Add the 'split' attribute which describes the configurations included.
     String8 splitName("config.");
     splitName.append(split->getPackageSafeName());
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 6d03311..e87138c 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -4527,7 +4527,7 @@
         return NO_ERROR;
     }
 
-    Vector<key_value_pair_t<sp<XMLNode>, size_t> > attrsToRemove;
+    sp<XMLNode> newRoot = NULL;
 
     Vector<sp<XMLNode> > nodesToVisit;
     nodesToVisit.push(root);
@@ -4536,11 +4536,23 @@
         nodesToVisit.pop();
 
         const Vector<XMLNode::attribute_entry>& attrs = node->getAttributes();
-        const size_t attrCount = attrs.size();
-        for (size_t i = 0; i < attrCount; i++) {
+        for (size_t i = 0; i < attrs.size(); i++) {
             const XMLNode::attribute_entry& attr = attrs[i];
             if (isAttributeFromL(attr.nameResId)) {
-                attrsToRemove.add(key_value_pair_t<sp<XMLNode>, size_t>(node, i));
+                if (newRoot == NULL) {
+                    newRoot = root->clone();
+                }
+
+                if (bundle->getVerbose()) {
+                    SourcePos(node->getFilename(), node->getStartLineNumber()).printf(
+                            "removing attribute %s%s%s from <%s>",
+                            String8(attr.ns).string(),
+                            (attr.ns.size() == 0 ? "" : ":"),
+                            String8(attr.name).string(),
+                            String8(node->getElementName()).string());
+                }
+                node->removeAttribute(i);
+                i--;
             }
         }
 
@@ -4552,7 +4564,7 @@
         }
     }
 
-    if (attrsToRemove.isEmpty()) {
+    if (newRoot == NULL) {
         return NO_ERROR;
     }
 
@@ -4562,12 +4574,8 @@
     // Look to see if we already have an overriding v21 configuration.
     sp<ConfigList> cl = getConfigList(String16(mAssets->getPackage()),
             String16(target->getResourceType()), resourceName);
-    //if (cl == NULL) {
-    //    fprintf(stderr, "fuuuuck\n");
-    //}
     if (cl->getEntries().indexOfKey(newConfig) < 0) {
         // We don't have an overriding entry for v21, so we must duplicate this one.
-        sp<XMLNode> newRoot = root->clone();
         sp<AaptFile> newFile = new AaptFile(target->getSourceFile(),
                 AaptGroupEntry(newConfig), target->getResourceType());
         String8 resPath = String8::format("res/%s/%s",
@@ -4602,22 +4610,6 @@
         mWorkQueue.push(item);
     }
 
-    const size_t removeCount = attrsToRemove.size();
-    for (size_t i = 0; i < removeCount; i++) {
-        sp<XMLNode> node = attrsToRemove[i].key;
-        size_t attrIndex = attrsToRemove[i].value;
-        const XMLNode::attribute_entry& ae = node->getAttributes()[attrIndex];
-        if (bundle->getVerbose()) {
-            SourcePos(node->getFilename(), node->getStartLineNumber()).printf(
-                    "removing attribute %s%s%s from <%s>",
-                    String8(ae.ns).string(),
-                    (ae.ns.size() == 0 ? "" : ":"),
-                    String8(ae.name).string(),
-                    String8(node->getElementName()).string());
-        }
-        node->removeAttribute(attrIndex);
-    }
-
     return NO_ERROR;
 }
 
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 12902bd..6543c03 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -487,6 +487,11 @@
         public long age24;  // timestamp of the strongest 2.4GHz BSSID (last time it was seen)
         public String BSSID24;
         public String BSSID5;
+        public int score; // Debug only, indicate last score used for autojoin/cell-handover
+        public int currentNetworkBoost; // Debug only, indicate boost applied to RSSI if current
+        public int bandPreferenceBoost; // Debug only, indicate boost applied to RSSI if current
+        public int lastChoiceBoost; // Debug only, indicate last choice applied to this configuration
+        public String lastChoiceConfig; // Debug only, indicate last choice applied to this configuration
 
         public Visibility() {
             rssi5 = INVALID_RSSI;
@@ -513,16 +518,23 @@
                 sbuf.append(",");
                 sbuf.append(Integer.toString(num24));
                 if (BSSID24 != null) sbuf.append(",").append(BSSID24);
-            } else {
-                sbuf.append("*");
             }
-            sbuf.append(" - ");
+            sbuf.append("; ");
             if (rssi5 > INVALID_RSSI) {
                 sbuf.append(Integer.toString(rssi5));
                 sbuf.append(",");
                 sbuf.append(Integer.toString(num5));
                 if (BSSID5 != null) sbuf.append(",").append(BSSID5);
             }
+            if (score != 0) {
+                sbuf.append("; ").append(score);
+                sbuf.append(", ").append(currentNetworkBoost);
+                sbuf.append(", ").append(bandPreferenceBoost);
+                if (lastChoiceConfig != null) {
+                    sbuf.append(", ").append(lastChoiceBoost);
+                    sbuf.append(", ").append(lastChoiceConfig);
+                }
+            }
             sbuf.append("]");
             return sbuf.toString();
         }