Merge "Send captive portal broadcast as user CURRENT." into lmp-dev
diff --git a/api/current.txt b/api/current.txt
index c363803..d34fe56 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -3595,8 +3595,11 @@
   }
 
   public class ActivityManager {
+    method public int addAppTask(android.app.Activity, android.content.Intent, android.app.ActivityManager.TaskDescription, android.graphics.Bitmap);
     method public boolean clearApplicationUserData();
     method public void dumpPackageState(java.io.FileDescriptor, java.lang.String);
+    method public int getAppTaskThumbnailHeight();
+    method public int getAppTaskThumbnailWidth();
     method public java.util.List<android.app.ActivityManager.AppTask> getAppTasks();
     method public android.content.pm.ConfigurationInfo getDeviceConfigurationInfo();
     method public int getLargeMemoryClass();
@@ -3630,6 +3633,7 @@
   public static class ActivityManager.AppTask {
     method public void finishAndRemoveTask();
     method public android.app.ActivityManager.RecentTaskInfo getTaskInfo();
+    method public void setExcludeFromRecents(boolean);
   }
 
   public static class ActivityManager.MemoryInfo implements android.os.Parcelable {
@@ -5412,7 +5416,6 @@
     method public java.lang.String[] getAccountTypesWithManagementDisabled();
     method public java.util.List<android.content.ComponentName> getActiveAdmins();
     method public android.os.Bundle getApplicationRestrictions(android.content.ComponentName, java.lang.String);
-    method public boolean getBlockUninstall(android.content.ComponentName, java.lang.String);
     method public boolean getCameraDisabled(android.content.ComponentName);
     method public boolean getCrossProfileCallerIdDisabled(android.content.ComponentName);
     method public java.util.List<java.lang.String> getCrossProfileWidgetProviders(android.content.ComponentName);
@@ -5439,6 +5442,7 @@
     method public boolean getStorageEncryption(android.content.ComponentName);
     method public int getStorageEncryptionStatus();
     method public java.util.List<java.lang.String> getTrustAgentFeaturesEnabled(android.content.ComponentName, android.content.ComponentName);
+    method public boolean getUninstallBlocked(android.content.ComponentName, java.lang.String);
     method public boolean hasCaCertInstalled(byte[]);
     method public boolean hasGrantedPolicy(android.content.ComponentName, int);
     method public boolean installCaCert(android.content.ComponentName, byte[]);
@@ -5457,8 +5461,6 @@
     method public void setAccountManagementDisabled(android.content.ComponentName, java.lang.String, boolean);
     method public boolean setApplicationHidden(android.content.ComponentName, java.lang.String, boolean);
     method public void setApplicationRestrictions(android.content.ComponentName, java.lang.String, android.os.Bundle);
-    method public int setApplicationsHidden(android.content.ComponentName, android.content.Intent, boolean);
-    method public void setBlockUninstall(android.content.ComponentName, java.lang.String, boolean);
     method public void setCameraDisabled(android.content.ComponentName, boolean);
     method public void setCrossProfileCallerIdDisabled(android.content.ComponentName, boolean);
     method public void setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String);
@@ -5487,6 +5489,7 @@
     method public void setSecureSetting(android.content.ComponentName, java.lang.String, java.lang.String);
     method public int setStorageEncryption(android.content.ComponentName, boolean);
     method public void setTrustAgentFeaturesEnabled(android.content.ComponentName, android.content.ComponentName, java.util.List<java.lang.String>);
+    method public void setUninstallBlocked(android.content.ComponentName, java.lang.String, boolean);
     method public boolean switchUser(android.content.ComponentName, android.os.UserHandle);
     method public void uninstallAllUserCaCerts(android.content.ComponentName);
     method public void uninstallCaCert(android.content.ComponentName, byte[]);
@@ -5501,23 +5504,23 @@
     field public static final int ENCRYPTION_STATUS_UNSUPPORTED = 0; // 0x0
     field public static final java.lang.String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION";
     field public static final java.lang.String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN";
-    field public static final java.lang.String EXTRA_PROVISIONING_DEFAULT_MANAGED_PROFILE_NAME = "android.app.extra.defaultManagedProfileName";
-    field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM = "android.app.extra.deviceAdminPackageChecksum";
-    field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER = "android.app.extra.deviceAdminPackageDownloadCookieHeader";
-    field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION = "android.app.extra.deviceAdminPackageDownloadLocation";
-    field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME = "android.app.extra.deviceAdminPackageName";
-    field public static final java.lang.String EXTRA_PROVISIONING_EMAIL_ADDRESS = "android.app.extra.ManagedProfileEmailAddress";
-    field public static final java.lang.String EXTRA_PROVISIONING_LOCALE = "android.app.extra.locale";
-    field public static final java.lang.String EXTRA_PROVISIONING_LOCAL_TIME = "android.app.extra.localTime";
-    field public static final java.lang.String EXTRA_PROVISIONING_TIME_ZONE = "android.app.extra.timeZone";
-    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_HIDDEN = "android.app.extra.wifiHidden";
-    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_PAC_URL = "android.app.extra.wifiPacUrl";
-    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_PASSWORD = "android.app.extra.wifiPassword";
-    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_PROXY_BYPASS = "android.app.extra.wifiProxyBypassHosts";
-    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_PROXY_HOST = "android.app.extra.wifiProxyHost";
-    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_PROXY_PORT = "android.app.extra.wifiProxyPort";
-    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_SECURITY_TYPE = "android.app.extra.wifiSecurityType";
-    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_SSID = "android.app.extra.wifiSsid";
+    field public static final java.lang.String EXTRA_PROVISIONING_DEFAULT_MANAGED_PROFILE_NAME = "android.app.extra.DEFAULT_MANAGED_PROFILE_NAME";
+    field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM = "android.app.extra.DEVICE_ADMIN_PACKAGE_CHECKSUM";
+    field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER = "android.app.extra.DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER";
+    field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION = "android.app.extra.DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION";
+    field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME = "android.app.extra.DEVICE_ADMIN_PACKAGE_NAME";
+    field public static final java.lang.String EXTRA_PROVISIONING_EMAIL_ADDRESS = "android.app.extra.MANAGED_PROFILE_EMAIL_ADDRESS";
+    field public static final java.lang.String EXTRA_PROVISIONING_LOCALE = "android.app.extra.LOCALE";
+    field public static final java.lang.String EXTRA_PROVISIONING_LOCAL_TIME = "android.app.extra.LOCAL_TIME";
+    field public static final java.lang.String EXTRA_PROVISIONING_TIME_ZONE = "android.app.extra.TIME_ZONE";
+    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_HIDDEN = "android.app.extra.WIFI_HIDDEN";
+    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_PAC_URL = "android.app.extra.WIFI_PAC_URL";
+    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_PASSWORD = "android.app.extra.WIFI_PASSWORD";
+    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_PROXY_BYPASS = "android.app.extra.WIFI_PROXY_BYPASS_HOSTS";
+    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_PROXY_HOST = "android.app.extra.WIFI_PROXY_HOST";
+    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_PROXY_PORT = "android.app.extra.WIFI_PROXY_PORT";
+    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_SECURITY_TYPE = "android.app.extra.WIFI_SECURITY_TYPE";
+    field public static final java.lang.String EXTRA_PROVISIONING_WIFI_SSID = "android.app.extra.WIFI_SSID";
     field public static int FLAG_MANAGED_CAN_ACCESS_PARENT;
     field public static int FLAG_PARENT_CAN_ACCESS_MANAGED;
     field public static final int KEYGUARD_DISABLE_FEATURES_ALL = 2147483647; // 0x7fffffff
@@ -5528,6 +5531,7 @@
     field public static final int KEYGUARD_DISABLE_TRUST_AGENTS = 16; // 0x10
     field public static final int KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS = 8; // 0x8
     field public static final int KEYGUARD_DISABLE_WIDGETS_ALL = 1; // 0x1
+    field public static final java.lang.String MIME_TYPE_PROVISIONING_NFC = "application/com.android.managedprovisioning";
     field public static final int PASSWORD_QUALITY_ALPHABETIC = 262144; // 0x40000
     field public static final int PASSWORD_QUALITY_ALPHANUMERIC = 327680; // 0x50000
     field public static final int PASSWORD_QUALITY_BIOMETRIC_WEAK = 32768; // 0x8000
@@ -5536,7 +5540,6 @@
     field public static final int PASSWORD_QUALITY_NUMERIC_COMPLEX = 196608; // 0x30000
     field public static final int PASSWORD_QUALITY_SOMETHING = 65536; // 0x10000
     field public static final int PASSWORD_QUALITY_UNSPECIFIED = 0; // 0x0
-    field public static final java.lang.String PROVISIONING_NFC_MIME_TYPE = "application/com.android.managedprovisioning";
     field public static final int RESET_PASSWORD_REQUIRE_ENTRY = 1; // 0x1
     field public static final int WIPE_EXTERNAL_STORAGE = 1; // 0x1
   }
@@ -12683,7 +12686,7 @@
     method public T get(android.hardware.camera2.CameraCharacteristics.Key<T>);
     method public java.util.List<android.hardware.camera2.CaptureRequest.Key<?>> getAvailableCaptureRequestKeys();
     method public java.util.List<android.hardware.camera2.CaptureResult.Key<?>> getAvailableCaptureResultKeys();
-    field public static final android.hardware.camera2.CameraCharacteristics.Key COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES;
+    field public static final android.hardware.camera2.CameraCharacteristics.Key COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES;
     field public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AE_AVAILABLE_ANTIBANDING_MODES;
     field public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AE_AVAILABLE_MODES;
     field public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES;
@@ -12797,9 +12800,9 @@
 
   public abstract class CameraMetadata {
     method public java.util.List<TKey> getKeys();
-    field public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_FAST = 1; // 0x1
-    field public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_HIGH_QUALITY = 2; // 0x2
-    field public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_OFF = 0; // 0x0
+    field public static final int COLOR_CORRECTION_ABERRATION_MODE_FAST = 1; // 0x1
+    field public static final int COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY = 2; // 0x2
+    field public static final int COLOR_CORRECTION_ABERRATION_MODE_OFF = 0; // 0x0
     field public static final int COLOR_CORRECTION_MODE_FAST = 1; // 0x1
     field public static final int COLOR_CORRECTION_MODE_HIGH_QUALITY = 2; // 0x2
     field public static final int COLOR_CORRECTION_MODE_TRANSFORM_MATRIX = 0; // 0x0
@@ -12990,7 +12993,7 @@
     method public java.lang.Object getTag();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.hardware.camera2.CaptureRequest.Key BLACK_LEVEL_LOCK;
-    field public static final android.hardware.camera2.CaptureRequest.Key COLOR_CORRECTION_ABERRATION_CORRECTION_MODE;
+    field public static final android.hardware.camera2.CaptureRequest.Key COLOR_CORRECTION_ABERRATION_MODE;
     field public static final android.hardware.camera2.CaptureRequest.Key COLOR_CORRECTION_GAINS;
     field public static final android.hardware.camera2.CaptureRequest.Key COLOR_CORRECTION_MODE;
     field public static final android.hardware.camera2.CaptureRequest.Key COLOR_CORRECTION_TRANSFORM;
@@ -13062,7 +13065,7 @@
     method public android.hardware.camera2.CaptureRequest getRequest();
     method public int getSequenceId();
     field public static final android.hardware.camera2.CaptureResult.Key BLACK_LEVEL_LOCK;
-    field public static final android.hardware.camera2.CaptureResult.Key COLOR_CORRECTION_ABERRATION_CORRECTION_MODE;
+    field public static final android.hardware.camera2.CaptureResult.Key COLOR_CORRECTION_ABERRATION_MODE;
     field public static final android.hardware.camera2.CaptureResult.Key COLOR_CORRECTION_GAINS;
     field public static final android.hardware.camera2.CaptureResult.Key COLOR_CORRECTION_MODE;
     field public static final android.hardware.camera2.CaptureResult.Key COLOR_CORRECTION_TRANSFORM;
diff --git a/core/java/android/animation/Animator.java b/core/java/android/animation/Animator.java
index 5f80ed7..3720c81 100644
--- a/core/java/android/animation/Animator.java
+++ b/core/java/android/animation/Animator.java
@@ -370,6 +370,7 @@
      * @hide
      */
     public void reverse() {
+        throw new IllegalStateException("Reverse is not supported");
     }
 
     /**
diff --git a/core/java/android/animation/RevealAnimator.java b/core/java/android/animation/RevealAnimator.java
index e363a77..0f85f49 100644
--- a/core/java/android/animation/RevealAnimator.java
+++ b/core/java/android/animation/RevealAnimator.java
@@ -26,148 +26,21 @@
  *
  * @hide
  */
-public class RevealAnimator extends ValueAnimator {
+public class RevealAnimator extends RenderNodeAnimator {
 
     private View mClipView;
-    private int mX, mY;
-    private float mStartRadius, mEndRadius;
-    private float mDelta;
-    private boolean mMayRunAsync;
-
-    // If this is null, we are running on the UI thread driven by the base
-    // ValueAnimator class. If this is not null, forward requests on to this
-    // Animator instead.
-    private RenderNodeAnimator mRtAnimator;
 
     public RevealAnimator(View clipView, int x, int y,
             float startRadius, float endRadius) {
+        super(x, y, startRadius, endRadius);
         mClipView = clipView;
-        mStartRadius = startRadius;
-        mEndRadius = endRadius;
-        mDelta = endRadius - startRadius;
-        mX = x;
-        mY = y;
-        super.setValues(PropertyValuesHolder.ofFloat("radius", startRadius, endRadius));
+        setTarget(mClipView);
     }
 
     @Override
-    void animateValue(float fraction) {
-        super.animateValue(fraction);
-        fraction = getAnimatedFraction();
-        float radius = mStartRadius + (mDelta * fraction);
-        mClipView.setRevealClip(true, mX, mY, radius);
-    }
-
-    @Override
-    protected void endAnimation(AnimationHandler handler) {
+    protected void onFinished() {
         mClipView.setRevealClip(false, 0, 0, 0);
-        super.endAnimation(handler);
+        super.onFinished();
     }
 
-    @Override
-    public void setAllowRunningAsynchronously(boolean mayRunAsync) {
-        mMayRunAsync = mayRunAsync;
-    }
-
-    private boolean canRunAsync() {
-        if (!mMayRunAsync) {
-            return false;
-        }
-        if (mUpdateListeners != null && mUpdateListeners.size() > 0) {
-            return false;
-        }
-        // TODO: Have RNA support this
-        if (getRepeatCount() != 0) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public void start() {
-        if (mRtAnimator != null) {
-            mRtAnimator.end();
-            mRtAnimator = null;
-        }
-        if (canRunAsync()) {
-            mRtAnimator = new RenderNodeAnimator(mX, mY, mStartRadius, mEndRadius);
-            mRtAnimator.setDuration(getDuration());
-            mRtAnimator.setInterpolator(getInterpolator());
-            mRtAnimator.setTarget(mClipView);
-            // TODO: Listeners
-            mRtAnimator.start();
-        } else {
-            super.start();
-        }
-    }
-
-    @Override
-    public void cancel() {
-        if (mRtAnimator != null) {
-            mRtAnimator.cancel();
-        } else {
-            super.cancel();
-        }
-    }
-
-    @Override
-    public void end() {
-        if (mRtAnimator != null) {
-            mRtAnimator.end();
-        } else {
-            super.end();
-        }
-    }
-
-    @Override
-    public void resume() {
-        if (mRtAnimator != null) {
-            // TODO: Support? Reject?
-        } else {
-            super.resume();
-        }
-    }
-
-    @Override
-    public void pause() {
-        if (mRtAnimator != null) {
-            // TODO: see resume()
-        } else {
-            super.pause();
-        }
-    }
-
-    @Override
-    public boolean isRunning() {
-        if (mRtAnimator != null) {
-            return mRtAnimator.isRunning();
-        } else {
-            return super.isRunning();
-        }
-    }
-
-    @Override
-    public boolean isStarted() {
-        if (mRtAnimator != null) {
-            return mRtAnimator.isStarted();
-        } else {
-            return super.isStarted();
-        }
-    }
-
-    @Override
-    public void reverse() {
-        if (mRtAnimator != null) {
-            // TODO support
-        } else {
-            super.reverse();
-        }
-    }
-
-    @Override
-    public RevealAnimator clone() {
-        RevealAnimator anim = (RevealAnimator) super.clone();
-        anim.mRtAnimator = null;
-        return anim;
-    }
 }
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 4b022ff..b86621f 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -16,6 +16,11 @@
 
 package android.app;
 
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.graphics.Canvas;
+import android.graphics.Matrix;
+import android.graphics.Point;
 import android.os.BatteryStats;
 import android.os.IBinder;
 import android.os.ParcelFileDescriptor;
@@ -47,16 +52,13 @@
 import android.os.UserHandle;
 import android.text.TextUtils;
 import android.util.DisplayMetrics;
-import android.util.Log;
 import android.util.Slog;
 
 import java.io.FileDescriptor;
 import java.io.FileOutputStream;
 import java.io.PrintWriter;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * Interact with the overall activities running in the system.
@@ -297,6 +299,8 @@
     /** @hide Process is being cached for later use and is empty. */
     public static final int PROCESS_STATE_CACHED_EMPTY = 13;
 
+    Point mAppTaskThumbnailSize;
+
     /*package*/ ActivityManager(Context context, Handler handler) {
         mContext = context;
         mHandler = handler;
@@ -994,6 +998,103 @@
     }
 
     /**
+     * Return the current design width for {@link AppTask} thumbnails, for use
+     * with {@link #addAppTask}.
+     */
+    public int getAppTaskThumbnailWidth() {
+        synchronized (this) {
+            ensureAppTaskThumbnailSizeLocked();
+            return mAppTaskThumbnailSize.x;
+        }
+    }
+
+    /**
+     * Return the current design height for {@link AppTask} thumbnails, for use
+     * with {@link #addAppTask}.
+     */
+    public int getAppTaskThumbnailHeight() {
+        synchronized (this) {
+            ensureAppTaskThumbnailSizeLocked();
+            return mAppTaskThumbnailSize.y;
+        }
+    }
+
+    private void ensureAppTaskThumbnailSizeLocked() {
+        if (mAppTaskThumbnailSize == null) {
+            try {
+                mAppTaskThumbnailSize = ActivityManagerNative.getDefault().getAppTaskThumbnailSize();
+            } catch (RemoteException e) {
+                throw new IllegalStateException("System dead?", e);
+            }
+        }
+    }
+
+    /**
+     * Add a new {@link AppTask} for the calling application.  This will create a new
+     * recents entry that is added to the <b>end</b> of all existing recents.
+     *
+     * @param activity The activity that is adding the entry.   This is used to help determine
+     * the context that the new recents entry will be in.
+     * @param intent The Intent that describes the recents entry.  This is the same Intent that
+     * you would have used to launch the activity for it.  In generally you will want to set
+     * both {@link Intent#FLAG_ACTIVITY_NEW_DOCUMENT} and
+     * {@link Intent#FLAG_ACTIVITY_RETAIN_IN_RECENTS}; the latter is required since this recents
+     * entry will exist without an activity, so it doesn't make sense to not retain it when
+     * its activity disappears.  The given Intent here also must have an explicit ComponentName
+     * set on it.
+     * @param description Optional additional description information.
+     * @param thumbnail Thumbnail to use for the recents entry.  Should be the size given by
+     * {@link #getAppTaskThumbnailWidth()} and {@link #getAppTaskThumbnailHeight()}.  If the
+     * bitmap is not that exact size, it will be recreated in your process, probably in a way
+     * you don't like, before the recents entry is added.
+     *
+     * @return Returns the task id of the newly added app task, or -1 if the add failed.  The
+     * most likely cause of failure is that there is no more room for more tasks for your app.
+     */
+    public int addAppTask(@NonNull Activity activity, @NonNull Intent intent,
+            @Nullable TaskDescription description, @NonNull Bitmap thumbnail) {
+        Point size;
+        synchronized (this) {
+            ensureAppTaskThumbnailSizeLocked();
+            size = mAppTaskThumbnailSize;
+        }
+        final int tw = thumbnail.getWidth();
+        final int th = thumbnail.getHeight();
+        if (tw != size.x || th != size.y) {
+            Bitmap bm = Bitmap.createBitmap(size.x, size.y, thumbnail.getConfig());
+
+            // Use ScaleType.CENTER_CROP, except we leave the top edge at the top.
+            float scale;
+            float dx = 0, dy = 0;
+            if (tw * size.x > size.y * th) {
+                scale = (float) size.x / (float) th;
+                dx = (size.y - tw * scale) * 0.5f;
+            } else {
+                scale = (float) size.y / (float) tw;
+                dy = (size.x - th * scale) * 0.5f;
+            }
+            Matrix matrix = new Matrix();
+            matrix.setScale(scale, scale);
+            matrix.postTranslate((int) (dx + 0.5f), 0);
+
+            Canvas canvas = new Canvas(bm);
+            canvas.drawBitmap(thumbnail, matrix, null);
+            canvas.setBitmap(null);
+
+            thumbnail = bm;
+        }
+        if (description == null) {
+            description = new TaskDescription();
+        }
+        try {
+            return ActivityManagerNative.getDefault().addAppTask(activity.getActivityToken(),
+                    intent, description, thumbnail);
+        } catch (RemoteException e) {
+            throw new IllegalStateException("System dead?", e);
+        }
+    }
+
+    /**
      * Return a list of the tasks that are currently running, with
      * the most recent being first and older ones after in order.  Note that
      * "running" does not mean any of the task's code is currently loaded or
@@ -2514,5 +2615,20 @@
                 return null;
             }
         }
+
+        /**
+         * Modify the {@link Intent#FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS} flag in the root
+         * Intent of this AppTask.
+         *
+         * @param exclude If true, {@link Intent#FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS} will
+         * be set; otherwise, it will be cleared.
+         */
+        public void setExcludeFromRecents(boolean exclude) {
+            try {
+                mAppTaskImpl.setExcludeFromRecents(exclude);
+            } catch (RemoteException e) {
+                Slog.e(TAG, "Invalid AppTask", e);
+            }
+        }
     }
 }
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 1cb1047..3dafa4b 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -30,6 +30,8 @@
 import android.content.pm.ParceledListSlice;
 import android.content.pm.UserInfo;
 import android.content.res.Configuration;
+import android.graphics.Bitmap;
+import android.graphics.Point;
 import android.graphics.Rect;
 import android.net.Uri;
 import android.os.Binder;
@@ -564,6 +566,27 @@
             return true;
         }
 
+        case ADD_APP_TASK_TRANSACTION: {
+            data.enforceInterface(IActivityManager.descriptor);
+            IBinder activityToken = data.readStrongBinder();
+            Intent intent = Intent.CREATOR.createFromParcel(data);
+            ActivityManager.TaskDescription descr
+                    = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
+            Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
+            int res = addAppTask(activityToken, intent, descr, thumbnail);
+            reply.writeNoException();
+            reply.writeInt(res);
+            return true;
+        }
+
+        case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
+            data.enforceInterface(IActivityManager.descriptor);
+            Point size = getAppTaskThumbnailSize();
+            reply.writeNoException();
+            size.writeToParcel(reply, 0);
+            return true;
+        }
+
         case GET_TASKS_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             int maxNum = data.readInt();
@@ -2877,6 +2900,33 @@
         reply.recycle();
         return list;
     }
+    public int addAppTask(IBinder activityToken, Intent intent,
+            ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
+        Parcel data = Parcel.obtain();
+        Parcel reply = Parcel.obtain();
+        data.writeInterfaceToken(IActivityManager.descriptor);
+        data.writeStrongBinder(activityToken);
+        intent.writeToParcel(data, 0);
+        description.writeToParcel(data, 0);
+        thumbnail.writeToParcel(data, 0);
+        mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
+        reply.readException();
+        int res = reply.readInt();
+        data.recycle();
+        reply.recycle();
+        return res;
+    }
+    public Point getAppTaskThumbnailSize() throws RemoteException {
+        Parcel data = Parcel.obtain();
+        Parcel reply = Parcel.obtain();
+        data.writeInterfaceToken(IActivityManager.descriptor);
+        mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
+        reply.readException();
+        Point size = Point.CREATOR.createFromParcel(reply);
+        data.recycle();
+        reply.recycle();
+        return size;
+    }
     public List getTasks(int maxNum, int flags) throws RemoteException {
         Parcel data = Parcel.obtain();
         Parcel reply = Parcel.obtain();
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index b2812e3..9342ae5 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -749,10 +749,10 @@
             putCachedIcon(name, dr);
             return dr;
         } catch (NameNotFoundException e) {
-            Log.w("PackageManager", "Failure retrieving resources for"
+            Log.w("PackageManager", "Failure retrieving resources for "
                   + appInfo.packageName);
         } catch (Resources.NotFoundException e) {
-            Log.w("PackageManager", "Failure retrieving resources for"
+            Log.w("PackageManager", "Failure retrieving resources for "
                   + appInfo.packageName + ": " + e.getMessage());
         } catch (RuntimeException e) {
             // If an exception was thrown, fall through to return
@@ -1100,7 +1100,7 @@
             putCachedString(name, text);
             return text;
         } catch (NameNotFoundException e) {
-            Log.w("PackageManager", "Failure retrieving resources for"
+            Log.w("PackageManager", "Failure retrieving resources for "
                   + appInfo.packageName);
         } catch (RuntimeException e) {
             // If an exception was thrown, fall through to return
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 8e21899..70514d8 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -36,6 +36,7 @@
 import android.content.pm.UserInfo;
 import android.content.res.Configuration;
 import android.graphics.Bitmap;
+import android.graphics.Point;
 import android.graphics.Rect;
 import android.net.Uri;
 import android.os.Bundle;
@@ -119,6 +120,9 @@
     public String getCallingPackage(IBinder token) throws RemoteException;
     public ComponentName getCallingActivity(IBinder token) throws RemoteException;
     public List<IAppTask> getAppTasks() throws RemoteException;
+    public int addAppTask(IBinder activityToken, Intent intent,
+            ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException;
+    public Point getAppTaskThumbnailSize() throws RemoteException;
     public List<RunningTaskInfo> getTasks(int maxNum, int flags) throws RemoteException;
     public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
             int flags, int userId) throws RemoteException;
@@ -765,4 +769,6 @@
     int NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+230;
     int KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+231;
     int START_ACTIVITY_AS_CALLER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+232;
+    int ADD_APP_TASK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+233;
+    int GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+234;
 }
diff --git a/core/java/android/app/IAppTask.aidl b/core/java/android/app/IAppTask.aidl
index 268b4dd..4e38c36 100644
--- a/core/java/android/app/IAppTask.aidl
+++ b/core/java/android/app/IAppTask.aidl
@@ -22,4 +22,5 @@
 interface IAppTask {
     void finishAndRemoveTask();
     ActivityManager.RecentTaskInfo getTaskInfo();
+    void setExcludeFromRecents(boolean exclude);
 }
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 70ba8ea..47967ba 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -40,6 +40,7 @@
 import android.os.UserManager;
 import android.text.TextUtils;
 import android.util.Log;
+import android.util.MathUtils;
 import android.util.TypedValue;
 import android.view.Gravity;
 import android.view.View;
@@ -1755,6 +1756,7 @@
      */
     public static class Builder {
         private static final int MAX_ACTION_BUTTONS = 3;
+        private static final float LARGE_TEXT_SCALE = 1.3f;
 
         /**
          * @hide
@@ -2577,28 +2579,14 @@
             return bitmap;
         }
 
-        private RemoteViews applyStandardTemplate(int resId, boolean fitIn1U) {
-            final boolean largeFontScale
-                    = mContext.getResources().getConfiguration().fontScale >= 1.25f;
-
+        private RemoteViews applyStandardTemplate(int resId) {
             Bitmap profileIcon = getProfileBadge();
             RemoteViews contentView = new BuilderRemoteViews(mContext.getPackageName(),
                     mOriginatingUserId, resId);
 
-            if (largeFontScale) {
-                // Make a little extra room for the bigger text.
-                final int margin = (int) mContext.getResources()
-                        .getDimensionPixelSize(R.dimen.notification_large_font_vert_pad);
-                contentView.setViewPadding(R.id.line1, 0, margin, 0, 0);
-                contentView.setViewPadding(R.id.line3, 0, 0, 0, margin);
-            }
-
             boolean showLine3 = false;
             boolean showLine2 = false;
 
-            if (mPriority < PRIORITY_LOW) {
-                // TODO: Low priority presentation
-            }
             if (profileIcon != null) {
                 contentView.setImageViewBitmap(R.id.profile_icon, profileIcon);
                 contentView.setViewVisibility(R.id.profile_icon, View.VISIBLE);
@@ -2666,15 +2654,12 @@
                 }
             }
             if (showLine2) {
-                if (fitIn1U) {
-                    // need to shrink all the type to make sure everything fits
-                    final Resources res = mContext.getResources();
-                    final float subTextSize = res.getDimensionPixelSize(
-                            R.dimen.notification_subtext_size);
-                    contentView.setTextViewTextSize(R.id.text, TypedValue.COMPLEX_UNIT_PX, subTextSize);
-                }
-                // vertical centering
-                contentView.setViewPadding(R.id.line1, 0, 0, 0, 0);
+
+                // need to shrink all the type to make sure everything fits
+                final Resources res = mContext.getResources();
+                final float subTextSize = res.getDimensionPixelSize(
+                        R.dimen.notification_subtext_size);
+                contentView.setTextViewTextSize(R.id.text, TypedValue.COMPLEX_UNIT_PX, subTextSize);
             }
 
             if (mWhen != 0 && mShowWhen) {
@@ -2691,13 +2676,51 @@
                 contentView.setViewVisibility(R.id.time, View.GONE);
             }
 
+            // Adjust padding depending on line count and font size.
+            contentView.setViewPadding(R.id.line1, 0, calculateTopPadding(mContext,
+                    hasThreeLines(), mContext.getResources().getConfiguration().fontScale),
+                    0, 0);
+
             contentView.setViewVisibility(R.id.line3, showLine3 ? View.VISIBLE : View.GONE);
             contentView.setViewVisibility(R.id.overflow_divider, showLine3 ? View.VISIBLE : View.GONE);
             return contentView;
         }
 
+        /**
+         * Logic to find out whether the notification is going to have three lines in the contracted
+         * layout. This is used to adjust the top padding.
+         *
+         * @return true if the notification is going to have three lines; false if the notification
+         *         is going to have one or two lines
+         */
+        private boolean hasThreeLines() {
+            boolean hasLine3 = mContentText != null || mContentInfo != null || mNumber > 0;
+            boolean hasLine2 = (mSubText != null && mContentText != null) ||
+                    (mSubText == null && (mProgressMax != 0 || mProgressIndeterminate));
+            return hasLine2 && hasLine3;
+        }
+
+        /**
+         * @hide
+         */
+        public static int calculateTopPadding(Context ctx, boolean hasThreeLines,
+                float fontScale) {
+            int padding = ctx.getResources().getDimensionPixelSize(hasThreeLines
+                    ? R.dimen.notification_top_pad_narrow
+                    : R.dimen.notification_top_pad);
+            int largePadding = ctx.getResources().getDimensionPixelSize(hasThreeLines
+                    ? R.dimen.notification_top_pad_large_text_narrow
+                    : R.dimen.notification_top_pad_large_text);
+            float largeFactor = (MathUtils.constrain(fontScale, 1.0f, LARGE_TEXT_SCALE) - 1f)
+                    / (LARGE_TEXT_SCALE - 1f);
+
+            // Linearly interpolate the padding between large and normal with the font scale ranging
+            // from 1f to LARGE_TEXT_SCALE
+            return Math.round((1 - largeFactor) * padding + largeFactor * largePadding);
+        }
+
         private RemoteViews applyStandardTemplateWithActions(int layoutId) {
-            RemoteViews big = applyStandardTemplate(layoutId, false);
+            RemoteViews big = applyStandardTemplate(layoutId);
 
             int N = mActions.size();
             if (N > 0) {
@@ -2717,7 +2740,7 @@
             if (mContentView != null) {
                 return mContentView;
             } else {
-                return applyStandardTemplate(getBaseLayoutResource(), true); // no more special large_icon flavor
+                return applyStandardTemplate(getBaseLayoutResource());
             }
         }
 
@@ -2810,7 +2833,7 @@
          */
         private void applyLargeIconBackground(RemoteViews contentView) {
             contentView.setInt(R.id.icon, "setBackgroundResource",
-                    R.drawable.notification_icon_legacy_bg_inset);
+                    R.drawable.notification_icon_legacy_bg);
 
             contentView.setDrawableParameters(
                     R.id.icon,
@@ -2819,6 +2842,10 @@
                     resolveColor(),
                     PorterDuff.Mode.SRC_ATOP,
                     -1);
+
+            int padding = mContext.getResources().getDimensionPixelSize(
+                    R.dimen.notification_large_icon_circle_padding);
+            contentView.setViewPadding(R.id.icon, padding, padding, padding, padding);
         }
 
         private void removeLargeIconBackground(RemoteViews contentView) {
@@ -3234,7 +3261,7 @@
         }
 
         private int getBigTextLayoutResource() {
-            return getBigBaseLayoutResource();
+            return R.layout.notification_template_material_big_text;
         }
 
         private int getInboxLayoutResource() {
@@ -3328,6 +3355,19 @@
         }
 
         /**
+         * Changes the padding of the first line such that the big and small content view have the
+         * same top padding.
+         *
+         * @hide
+         */
+        protected void applyTopPadding(RemoteViews contentView) {
+            int topPadding = Builder.calculateTopPadding(mBuilder.mContext,
+                    mBuilder.hasThreeLines(),
+                    mBuilder.mContext.getResources().getConfiguration().fontScale);
+            contentView.setViewPadding(R.id.line1, 0, topPadding, 0, 0);
+        }
+
+        /**
          * @hide
          */
         public void addExtras(Bundle extras) {
@@ -3465,6 +3505,8 @@
 
             contentView.setImageViewBitmap(R.id.big_picture, mPicture);
 
+            applyTopPadding(contentView);
+
             return contentView;
         }
 
@@ -3575,8 +3617,6 @@
         }
 
         private RemoteViews makeBigContentView() {
-            // Remove the content text so line3 only shows if you have a summary
-            final boolean hadThreeLines = (mBuilder.mContentText != null && mBuilder.mSubText != null);
 
             // Nasty
             CharSequence oldBuilderContentText = mBuilder.mContentText;
@@ -3586,15 +3626,12 @@
 
             mBuilder.mContentText = oldBuilderContentText;
 
-            if (hadThreeLines) {
-                // vertical centering
-                contentView.setViewPadding(R.id.line1, 0, 0, 0, 0);
-            }
-
             contentView.setTextViewText(R.id.big_text, mBuilder.processLegacyText(mBigText));
             contentView.setViewVisibility(R.id.big_text, View.VISIBLE);
             contentView.setViewVisibility(R.id.text2, View.GONE);
 
+            applyTopPadding(contentView);
+
             return contentView;
         }
 
@@ -3706,13 +3743,20 @@
                 contentView.setViewVisibility(rowId, View.GONE);
             }
 
-
+            final boolean largeText =
+                    mBuilder.mContext.getResources().getConfiguration().fontScale > 1f;
+            final float subTextSize = mBuilder.mContext.getResources().getDimensionPixelSize(
+                    R.dimen.notification_subtext_size);
             int i=0;
             while (i < mTexts.size() && i < rowIds.length) {
                 CharSequence str = mTexts.get(i);
                 if (str != null && !str.equals("")) {
                     contentView.setViewVisibility(rowIds[i], View.VISIBLE);
                     contentView.setTextViewText(rowIds[i], mBuilder.processLegacyText(str));
+                    if (largeText) {
+                        contentView.setTextViewTextSize(rowIds[i], TypedValue.COMPLEX_UNIT_PX,
+                                subTextSize);
+                    }
                 }
                 i++;
             }
@@ -3723,6 +3767,8 @@
             contentView.setViewVisibility(R.id.inbox_more,
                     mTexts.size() > rowIds.length ? View.VISIBLE : View.GONE);
 
+            applyTopPadding(contentView);
+
             return contentView;
         }
 
@@ -3876,7 +3922,7 @@
 
         private RemoteViews makeMediaContentView() {
             RemoteViews view = mBuilder.applyStandardTemplate(
-                    R.layout.notification_template_material_media, true /* 1U */);
+                    R.layout.notification_template_material_media);
 
             final int numActions = mBuilder.mActions.size();
             final int N = mActionsToShowInCompact == null
@@ -3901,7 +3947,7 @@
 
         private RemoteViews makeMediaBigContentView() {
             RemoteViews big = mBuilder.applyStandardTemplate(
-                    R.layout.notification_template_material_big_media, false);
+                    R.layout.notification_template_material_big_media);
 
             final int N = Math.min(mBuilder.mActions.size(), MAX_MEDIA_BUTTONS);
             if (N > 0) {
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 7111445..0dc8f66 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -55,7 +55,6 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.Set;
 
 /**
  * Public interface for managing policies enforced on a device.  Most clients
@@ -124,10 +123,10 @@
      * application that started provisioning. The package will be set as profile owner in that case.
      *
      * <p>This package is set as device owner when device owner provisioning is started by an Nfc
-     * message containing an Nfc record with MIME type {@link #PROVISIONING_NFC_MIME_TYPE}.
+     * message containing an Nfc record with MIME type {@link #MIME_TYPE_PROVISIONING_NFC}.
      */
     public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME
-        = "android.app.extra.deviceAdminPackageName";
+        = "android.app.extra.DEVICE_ADMIN_PACKAGE_NAME";
 
     /**
      * A String extra holding the default name of the profile that is created during managed profile
@@ -136,7 +135,7 @@
      * <p>Use with {@link #ACTION_PROVISION_MANAGED_PROFILE}
      */
     public static final String EXTRA_PROVISIONING_DEFAULT_MANAGED_PROFILE_NAME
-        = "android.app.extra.defaultManagedProfileName";
+        = "android.app.extra.DEFAULT_MANAGED_PROFILE_NAME";
 
     /**
      * A String extra that, holds the email address of the account which a managed profile is
@@ -150,137 +149,137 @@
      * It is usually used to avoid that the user has to enter their email address twice.
      */
     public static final String EXTRA_PROVISIONING_EMAIL_ADDRESS
-        = "android.app.extra.ManagedProfileEmailAddress";
+        = "android.app.extra.MANAGED_PROFILE_EMAIL_ADDRESS";
 
     /**
      * A String extra holding the time zone {@link android.app.AlarmManager} that the device
      * will be set to.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_TIME_ZONE
-        = "android.app.extra.timeZone";
+        = "android.app.extra.TIME_ZONE";
 
     /**
-     * A Long extra holding the local time {@link android.app.AlarmManager} that the device
-     * will be set to.
+     * A Long extra holding the wall clock time (in milliseconds) to be set on the device's
+     * {@link android.app.AlarmManager}.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_LOCAL_TIME
-        = "android.app.extra.localTime";
+        = "android.app.extra.LOCAL_TIME";
 
     /**
      * A String extra holding the {@link java.util.Locale} that the device will be set to.
      * Format: xx_yy, where xx is the language code, and yy the country code.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_LOCALE
-        = "android.app.extra.locale";
+        = "android.app.extra.LOCALE";
 
     /**
      * A String extra holding the ssid of the wifi network that should be used during nfc device
      * owner provisioning for downloading the mobile device management application.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_WIFI_SSID
-        = "android.app.extra.wifiSsid";
+        = "android.app.extra.WIFI_SSID";
 
     /**
      * A boolean extra indicating whether the wifi network in {@link #EXTRA_PROVISIONING_WIFI_SSID}
      * is hidden or not.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_WIFI_HIDDEN
-        = "android.app.extra.wifiHidden";
+        = "android.app.extra.WIFI_HIDDEN";
 
     /**
      * A String extra indicating the security type of the wifi network in
      * {@link #EXTRA_PROVISIONING_WIFI_SSID}.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_WIFI_SECURITY_TYPE
-        = "android.app.extra.wifiSecurityType";
+        = "android.app.extra.WIFI_SECURITY_TYPE";
 
     /**
      * A String extra holding the password of the wifi network in
      * {@link #EXTRA_PROVISIONING_WIFI_SSID}.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_WIFI_PASSWORD
-        = "android.app.extra.wifiPassword";
+        = "android.app.extra.WIFI_PASSWORD";
 
     /**
      * A String extra holding the proxy host for the wifi network in
      * {@link #EXTRA_PROVISIONING_WIFI_SSID}.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_WIFI_PROXY_HOST
-        = "android.app.extra.wifiProxyHost";
+        = "android.app.extra.WIFI_PROXY_HOST";
 
     /**
      * An int extra holding the proxy port for the wifi network in
      * {@link #EXTRA_PROVISIONING_WIFI_SSID}.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_WIFI_PROXY_PORT
-        = "android.app.extra.wifiProxyPort";
+        = "android.app.extra.WIFI_PROXY_PORT";
 
     /**
      * A String extra holding the proxy bypass for the wifi network in
      * {@link #EXTRA_PROVISIONING_WIFI_SSID}.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_WIFI_PROXY_BYPASS
-        = "android.app.extra.wifiProxyBypassHosts";
+        = "android.app.extra.WIFI_PROXY_BYPASS_HOSTS";
 
     /**
      * A String extra holding the proxy auto-config (PAC) URL for the wifi network in
      * {@link #EXTRA_PROVISIONING_WIFI_SSID}.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_WIFI_PAC_URL
-        = "android.app.extra.wifiPacUrl";
+        = "android.app.extra.WIFI_PAC_URL";
 
     /**
      * A String extra holding a url that specifies the download location of the device admin
      * package. When not provided it is assumed that the device admin package is already installed.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION
-        = "android.app.extra.deviceAdminPackageDownloadLocation";
+        = "android.app.extra.DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION";
 
     /**
      * A String extra holding a http cookie header which should be used in the http request to the
      * url specified in {@link #EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION}.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER
-        = "android.app.extra.deviceAdminPackageDownloadCookieHeader";
+        = "android.app.extra.DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER";
 
     /**
      * A String extra holding the SHA-1 checksum of the file at download location specified in
@@ -288,11 +287,11 @@
      * the file at the download location an error will be shown to the user and the user will be
      * asked to factory reset the device.
      *
-     * <p>Use in an Nfc record with {@link #PROVISIONING_NFC_MIME_TYPE} that starts device owner
+     * <p>Use in an Nfc record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner
      * provisioning via an Nfc bump.
      */
     public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM
-        = "android.app.extra.deviceAdminPackageChecksum";
+        = "android.app.extra.DEVICE_ADMIN_PACKAGE_CHECKSUM";
 
     /**
      * This MIME type is used for starting the Device Owner provisioning.
@@ -336,7 +335,7 @@
      * <p>Input: Nothing.</p>
      * <p>Output: Nothing</p>
      */
-    public static final String PROVISIONING_NFC_MIME_TYPE
+    public static final String MIME_TYPE_PROVISIONING_NFC
         = "application/com.android.managedprovisioning";
 
     /**
@@ -1875,12 +1874,16 @@
     }
 
     /**
-     * Called by a device/profile owner to set whether the screen capture is disabled.
+     * Called by a device/profile owner to set whether the screen capture is disabled. Disabling
+     * screen capture also prevents the content from being shown on display devices that do not have
+     * a secure video output. See {@link android.view.Display#FLAG_SECURE} for more details about
+     * secure surfaces and secure displays.
      *
      * <p>The calling device admin must be a device or profile owner. If it is not, a
      * security exception will be thrown.
      *
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
+     * @param disabled Whether or not screen capture should be disabled.
      */
     public void setScreenCaptureDisabled(ComponentName admin, boolean disabled) {
         if (mService != null) {
@@ -2157,6 +2160,7 @@
     }
 
     /** @hide */
+    @SystemApi
     public String getDeviceOwner() {
         if (mService != null) {
             try {
@@ -2365,6 +2369,7 @@
      * owner has been set for that user.
      * @throws IllegalArgumentException if the userId is invalid.
      */
+    @SystemApi
     public ComponentName getProfileOwner() throws IllegalArgumentException {
         return getProfileOwnerAsUser(Process.myUserHandle().getIdentifier());
     }
@@ -2978,28 +2983,6 @@
     }
 
     /**
-     * Called by profile or device owner to hide or unhide currently installed packages. This
-     * should only be called by a profile or device owner running within a managed profile.
-     *
-     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
-     * @param intent An intent matching the app(s) to be updated. All apps that resolve for this
-     *               intent will be updated in the current profile.
-     * @param hidden {@code true} if the packages should be hidden, {@code false} if they should
-     *                 be unhidden.
-     * @return int The number of activities that matched the intent and were updated.
-     */
-    public int setApplicationsHidden(ComponentName admin, Intent intent, boolean hidden) {
-        if (mService != null) {
-            try {
-                return mService.setApplicationsHidden(admin, intent, hidden);
-            } catch (RemoteException e) {
-                Log.w(TAG, "Failed talking with device policy service", e);
-            }
-        }
-        return 0;
-    }
-
-    /**
      * Called by device or profile owner to determine if a package is hidden.
      *
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
@@ -3265,12 +3248,13 @@
      *
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
      * @param packageName package to change.
-     * @param blockUninstall true if the user shouldn't be able to uninstall the package.
+     * @param uninstallBlocked true if the user shouldn't be able to uninstall the package.
      */
-    public void setBlockUninstall(ComponentName admin, String packageName, boolean blockUninstall) {
+    public void setUninstallBlocked(ComponentName admin, String packageName,
+            boolean uninstallBlocked) {
         if (mService != null) {
             try {
-                mService.setBlockUninstall(admin, packageName, blockUninstall);
+                mService.setUninstallBlocked(admin, packageName, uninstallBlocked);
             } catch (RemoteException re) {
                 Log.w(TAG, "Failed to call block uninstall on device policy service");
             }
@@ -3285,10 +3269,10 @@
      * @param packageName package to check.
      * @return true if the user shouldn't be able to uninstall the package.
      */
-    public boolean getBlockUninstall(ComponentName admin, String packageName) {
+    public boolean getUninstallBlocked(ComponentName admin, String packageName) {
         if (mService != null) {
             try {
-                return mService.getBlockUninstall(admin, packageName);
+                return mService.getUninstallBlocked(admin, packageName);
             } catch (RemoteException re) {
                 Log.w(TAG, "Failed to call block uninstall on device policy service");
             }
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index 5f8a2a4..1e17bb6 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -147,7 +147,6 @@
     List getPermittedInputMethodsForCurrentUser();
 
     boolean setApplicationHidden(in ComponentName admin, in String packageName, boolean hidden);
-    int setApplicationsHidden(in ComponentName admin, in Intent intent, boolean hidden);
     boolean isApplicationHidden(in ComponentName admin, in String packageName);
 
     UserHandle createUser(in ComponentName who, in String name);
@@ -174,8 +173,8 @@
 
     void notifyLockTaskModeChanged(boolean isEnabled, String pkg, int userId);
 
-    void setBlockUninstall(in ComponentName admin, in String packageName, boolean blockUninstall);
-    boolean getBlockUninstall(in ComponentName admin, in String packageName);
+    void setUninstallBlocked(in ComponentName admin, in String packageName, boolean uninstallBlocked);
+    boolean getUninstallBlocked(in ComponentName admin, in String packageName);
 
     void setCrossProfileCallerIdDisabled(in ComponentName who, boolean disabled);
     boolean getCrossProfileCallerIdDisabled(in ComponentName who);
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index 4e7f9dd..c525348 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -313,18 +313,18 @@
 
     /**
      * <p>The set of aberration correction modes supported by this camera device.</p>
-     * <p>This metadata lists the valid modes for {@link CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE android.colorCorrection.aberrationCorrectionMode}.
+     * <p>This metadata lists the valid modes for {@link CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE android.colorCorrection.aberrationMode}.
      * If no aberration correction modes are available for a device, this list will solely include
      * OFF mode.</p>
      * <p>For FULL capability device ({@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} <code>==</code> FULL), OFF must be
      * included.</p>
      *
-     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE
      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
      */
     @PublicKey
-    public static final Key<int[]> COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES =
-            new Key<int[]>("android.colorCorrection.availableAberrationCorrectionModes", int[].class);
+    public static final Key<int[]> COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES =
+            new Key<int[]>("android.colorCorrection.availableAberrationModes", int[].class);
 
     /**
      * <p>The set of auto-exposure antibanding modes that are
diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java
index 9bdfe8b..3c9b7b3 100644
--- a/core/java/android/hardware/camera2/CameraMetadata.java
+++ b/core/java/android/hardware/camera2/CameraMetadata.java
@@ -386,8 +386,8 @@
      * </ul>
      * </li>
      * <li>Manual aberration correction control (if aberration correction is supported)<ul>
-     * <li>{@link CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE android.colorCorrection.aberrationCorrectionMode}</li>
-     * <li>{@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES android.colorCorrection.availableAberrationCorrectionModes}</li>
+     * <li>{@link CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE android.colorCorrection.aberrationMode}</li>
+     * <li>{@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES android.colorCorrection.availableAberrationModes}</li>
      * </ul>
      * </li>
      * </ul>
@@ -396,8 +396,8 @@
      * <p>A given camera device may also support additional post-processing
      * controls, but this capability only covers the above list of controls.</p>
      *
-     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
-     * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES
+     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE
+     * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES
      * @see CaptureRequest#COLOR_CORRECTION_GAINS
      * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
      * @see CaptureRequest#SHADING_MODE
@@ -739,28 +739,28 @@
     public static final int COLOR_CORRECTION_MODE_HIGH_QUALITY = 2;
 
     //
-    // Enumeration values for CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+    // Enumeration values for CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE
     //
 
     /**
      * <p>No aberration correction is applied.</p>
-     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE
      */
-    public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_OFF = 0;
+    public static final int COLOR_CORRECTION_ABERRATION_MODE_OFF = 0;
 
     /**
      * <p>Aberration correction will not slow down capture rate
      * relative to sensor raw output.</p>
-     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE
      */
-    public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_FAST = 1;
+    public static final int COLOR_CORRECTION_ABERRATION_MODE_FAST = 1;
 
     /**
      * <p>Aberration correction operates at improved quality but reduced
      * capture rate (relative to sensor raw output).</p>
-     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE
      */
-    public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_HIGH_QUALITY = 2;
+    public static final int COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY = 2;
 
     //
     // Enumeration values for CaptureRequest#CONTROL_AE_ANTIBANDING_MODE
@@ -1213,7 +1213,8 @@
      * image while recording video) use case.</p>
      * <p>The camera device should take the highest-quality image
      * possible (given the other settings) without disrupting the
-     * frame rate of video recording.  </p>
+     * frame rate of video recording.<br />
+     * </p>
      * @see CaptureRequest#CONTROL_CAPTURE_INTENT
      */
     public static final int CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT = 4;
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index 97077e6..bcdcd62 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -569,7 +569,7 @@
     /**
      * <p>Mode of operation for the chromatic aberration correction algorithm.</p>
      * <p>This must be set to a valid mode from
-     * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES android.colorCorrection.availableAberrationCorrectionModes}.</p>
+     * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES android.colorCorrection.availableAberrationModes}.</p>
      * <p>Chromatic (color) aberration is caused by the fact that different wavelengths of light
      * can not focus on the same point after exiting from the lens. This metadata defines
      * the high level control of chromatic aberration correction algorithm, which aims to
@@ -581,14 +581,14 @@
      * capture rate. FAST means the camera device will not slow down capture rate when
      * applying aberration correction.</p>
      *
-     * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES
-     * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_OFF
-     * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_FAST
-     * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_HIGH_QUALITY
+     * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES
+     * @see #COLOR_CORRECTION_ABERRATION_MODE_OFF
+     * @see #COLOR_CORRECTION_ABERRATION_MODE_FAST
+     * @see #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY
      */
     @PublicKey
-    public static final Key<Integer> COLOR_CORRECTION_ABERRATION_CORRECTION_MODE =
-            new Key<Integer>("android.colorCorrection.aberrationCorrectionMode", int.class);
+    public static final Key<Integer> COLOR_CORRECTION_ABERRATION_MODE =
+            new Key<Integer>("android.colorCorrection.aberrationMode", int.class);
 
     /**
      * <p>The desired setting for the camera device's auto-exposure
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index 63dff55..f9c4df4 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -420,7 +420,7 @@
     /**
      * <p>Mode of operation for the chromatic aberration correction algorithm.</p>
      * <p>This must be set to a valid mode from
-     * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES android.colorCorrection.availableAberrationCorrectionModes}.</p>
+     * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES android.colorCorrection.availableAberrationModes}.</p>
      * <p>Chromatic (color) aberration is caused by the fact that different wavelengths of light
      * can not focus on the same point after exiting from the lens. This metadata defines
      * the high level control of chromatic aberration correction algorithm, which aims to
@@ -432,14 +432,14 @@
      * capture rate. FAST means the camera device will not slow down capture rate when
      * applying aberration correction.</p>
      *
-     * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES
-     * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_OFF
-     * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_FAST
-     * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_HIGH_QUALITY
+     * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES
+     * @see #COLOR_CORRECTION_ABERRATION_MODE_OFF
+     * @see #COLOR_CORRECTION_ABERRATION_MODE_FAST
+     * @see #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY
      */
     @PublicKey
-    public static final Key<Integer> COLOR_CORRECTION_ABERRATION_CORRECTION_MODE =
-            new Key<Integer>("android.colorCorrection.aberrationCorrectionMode", int.class);
+    public static final Key<Integer> COLOR_CORRECTION_ABERRATION_MODE =
+            new Key<Integer>("android.colorCorrection.aberrationMode", int.class);
 
     /**
      * <p>The desired setting for the camera device's auto-exposure
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 52f1dd9..2241716 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2674,6 +2674,9 @@
          */
         public static final String[] CLONE_TO_MANAGED_PROFILE = {
             DATE_FORMAT,
+            HAPTIC_FEEDBACK_ENABLED,
+            SOUND_EFFECTS_ENABLED,
+            TEXT_SHOW_PASSWORD,
             TIME_12_24
         };
 
@@ -4737,17 +4740,16 @@
 
         /**
          * List of TV inputs that are currently hidden. This is a string
-         * containing the IDs of all hidden TV inputs. Each ID is separated by ':'.
-         *
+         * containing the IDs of all hidden TV inputs. Each ID is encoded by
+         * {@link android.net.Uri#encode(String)} and separated by ':'.
          * @hide
          */
         public static final String TV_INPUT_HIDDEN_INPUTS = "tv_input_hidden_inputs";
 
         /**
          * List of custom TV input labels. This is a string containing <TV input id, custom name>
-         * pairs. Each pair is separated by ':' and TV input id and custom name are separated by
-         * ','.
-         *
+         * pairs. TV input id and custom name are encoded by {@link android.net.Uri#encode(String)}
+         * and separated by ','. Each pair is separated by ':'.
          * @hide
          */
         public static final String TV_INPUT_CUSTOM_LABELS = "tv_input_custom_labels";
diff --git a/core/java/android/view/RenderNodeAnimator.java b/core/java/android/view/RenderNodeAnimator.java
index c7f16e0..a56d448 100644
--- a/core/java/android/view/RenderNodeAnimator.java
+++ b/core/java/android/view/RenderNodeAnimator.java
@@ -93,6 +93,14 @@
 
     private long mUnscaledDuration = 300;
     private long mUnscaledStartDelay = 0;
+    // If this is true, we will run any start delays on the UI thread. This is
+    // the safe default, and is necessary to ensure start listeners fire at
+    // the correct time. Animators created by RippleDrawable (the
+    // CanvasProperty<> ones) do not have this expectation, and as such will
+    // set this to false so that the renderthread handles the startdelay instead
+    private final boolean mUiThreadHandlesDelay;
+    private long mStartDelay = 0;
+    private long mStartTime;
 
     public static int mapViewPropertyToRenderProperty(int viewProperty) {
         return sViewPropertyAnimatorMap.get(viewProperty);
@@ -101,6 +109,7 @@
     public RenderNodeAnimator(int property, float finalValue) {
         mRenderProperty = property;
         mFinalValue = finalValue;
+        mUiThreadHandlesDelay = true;
         init(nCreateAnimator(new WeakReference<RenderNodeAnimator>(this),
                 property, finalValue));
     }
@@ -109,6 +118,7 @@
         init(nCreateCanvasPropertyFloatAnimator(
                 new WeakReference<RenderNodeAnimator>(this),
                 property.getNativeContainer(), finalValue));
+        mUiThreadHandlesDelay = false;
     }
 
     /**
@@ -123,11 +133,13 @@
         init(nCreateCanvasPropertyPaintAnimator(
                 new WeakReference<RenderNodeAnimator>(this),
                 property.getNativeContainer(), paintField, finalValue));
+        mUiThreadHandlesDelay = false;
     }
 
     public RenderNodeAnimator(int x, int y, float startRadius, float endRadius) {
         init(nCreateRevealAnimator(new WeakReference<RenderNodeAnimator>(this),
                 x, y, startRadius, endRadius));
+        mUiThreadHandlesDelay = true;
     }
 
     private void init(long ptr) {
@@ -169,6 +181,16 @@
 
         mStarted = true;
         applyInterpolator();
+
+        if (mStartDelay <= 0 || !mUiThreadHandlesDelay) {
+            nSetStartDelay(mNativePtr.get(), mStartDelay);
+            doStart();
+        } else {
+            getHelper().addDelayedAnimation(this);
+        }
+    }
+
+    private void doStart() {
         nStart(mNativePtr.get());
 
         // Alpha is a special snowflake that has the canonical value stored
@@ -195,6 +217,7 @@
     @Override
     public void cancel() {
         if (!mFinished) {
+            getHelper().removeDelayedAnimation(this);
             nEnd(mNativePtr.get());
 
             final ArrayList<AnimatorListener> listeners = getListeners();
@@ -258,7 +281,7 @@
             throw new IllegalArgumentException("startDelay must be positive; " + startDelay);
         }
         mUnscaledStartDelay = startDelay;
-        nSetStartDelay(mNativePtr.get(), (long) (startDelay * ValueAnimator.getDurationScale()));
+        mStartDelay = (long) (ValueAnimator.getDurationScale() * startDelay);
     }
 
     @Override
@@ -303,7 +326,7 @@
         return mInterpolator;
     }
 
-    private void onFinished() {
+    protected void onFinished() {
         mFinished = true;
 
         final ArrayList<AnimatorListener> listeners = getListeners();
@@ -317,6 +340,82 @@
         return mNativePtr.get();
     }
 
+    /**
+     * @return true if the animator was started, false if still delayed
+     */
+    private boolean processDelayed(long frameTimeMs) {
+        if (mStartTime == 0) {
+            mStartTime = frameTimeMs;
+        } else if ((frameTimeMs - mStartTime) >= mStartDelay) {
+            doStart();
+            return true;
+        }
+        return false;
+    }
+
+    private static DelayedAnimationHelper getHelper() {
+        DelayedAnimationHelper helper = sAnimationHelper.get();
+        if (helper == null) {
+            helper = new DelayedAnimationHelper();
+            sAnimationHelper.set(helper);
+        }
+        return helper;
+    }
+
+    private static ThreadLocal<DelayedAnimationHelper> sAnimationHelper =
+            new ThreadLocal<DelayedAnimationHelper>();
+
+    private static class DelayedAnimationHelper implements Runnable {
+
+        private ArrayList<RenderNodeAnimator> mDelayedAnims = new ArrayList<RenderNodeAnimator>();
+        private final Choreographer mChoreographer;
+        private boolean mCallbackScheduled;
+
+        public DelayedAnimationHelper() {
+            mChoreographer = Choreographer.getInstance();
+        }
+
+        public void addDelayedAnimation(RenderNodeAnimator animator) {
+            mDelayedAnims.add(animator);
+            scheduleCallback();
+        }
+
+        public void removeDelayedAnimation(RenderNodeAnimator animator) {
+            mDelayedAnims.remove(animator);
+        }
+
+        private void scheduleCallback() {
+            if (!mCallbackScheduled) {
+                mCallbackScheduled = true;
+                mChoreographer.postCallback(Choreographer.CALLBACK_ANIMATION, this, null);
+            }
+        }
+
+        @Override
+        public void run() {
+            long frameTimeMs = mChoreographer.getFrameTime();
+            mCallbackScheduled = false;
+
+            int end = 0;
+            for (int i = 0; i < mDelayedAnims.size(); i++) {
+                RenderNodeAnimator animator = mDelayedAnims.get(i);
+                if (!animator.processDelayed(frameTimeMs)) {
+                    if (end != i) {
+                        mDelayedAnims.set(end, animator);
+                    }
+                    end++;
+                }
+            }
+            while (mDelayedAnims.size() > end) {
+                mDelayedAnims.remove(mDelayedAnims.size() - 1);
+            }
+
+            if (mDelayedAnims.size() > 0) {
+                scheduleCallback();
+            }
+        }
+    }
+
     // Called by native
     private static void callOnFinished(WeakReference<RenderNodeAnimator> weakThis) {
         RenderNodeAnimator animator = weakThis.get();
@@ -325,6 +424,11 @@
         }
     }
 
+    @Override
+    public Animator clone() {
+        throw new IllegalStateException("Cannot clone this animator");
+    }
+
     private static native long nCreateAnimator(WeakReference<RenderNodeAnimator> weakThis,
             int property, float finalValue);
     private static native long nCreateCanvasPropertyFloatAnimator(WeakReference<RenderNodeAnimator> weakThis,
diff --git a/core/java/android/view/RenderNodeAnimatorCompat.java b/core/java/android/view/RenderNodeAnimatorCompat.java
deleted file mode 100644
index 8103f47..0000000
--- a/core/java/android/view/RenderNodeAnimatorCompat.java
+++ /dev/null
@@ -1,151 +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.
- */
-
-package android.view;
-
-import android.animation.ValueAnimator;
-
-import java.util.ArrayList;
-
-/**
- * This class provides compatibility for things like start listeners &
- * start delays for use by ViewPropertyAnimator and ObjectAnimator
- * @hide
- */
-public class RenderNodeAnimatorCompat extends RenderNodeAnimator {
-
-    private long mUnscaledStartDelay = 0;
-    private long mStartDelay = 0;
-    private long mStartTime;
-    private boolean mCanceled;
-    private boolean mStarted;
-
-    public RenderNodeAnimatorCompat(int property, float finalValue) {
-        super(property, finalValue);
-    }
-
-    @Override
-    public void setStartDelay(long startDelay) {
-        mUnscaledStartDelay = startDelay;
-        mStartDelay = (long) (ValueAnimator.getDurationScale() * startDelay);
-    }
-
-    @Override
-    public long getStartDelay() {
-        return mUnscaledStartDelay;
-    }
-
-    @Override
-    public void start() {
-        mStarted = true;
-        if (mStartDelay <= 0) {
-            doStart();
-        } else {
-            getHelper().addDelayedAnimation(this);
-        }
-    }
-
-    @Override
-    public boolean isStarted() {
-        return mStarted;
-    }
-
-    private void doStart() {
-        if (!mCanceled) {
-            super.start();
-        }
-    }
-
-    @Override
-    public void cancel() {
-        mCanceled = true;
-        super.cancel();
-    }
-
-    /**
-     * @return true if the animator was started, false if still delayed
-     */
-    private boolean processDelayed(long frameTimeMs) {
-        if (mCanceled) return true;
-
-        if (mStartTime == 0) {
-            mStartTime = frameTimeMs;
-        } else if ((frameTimeMs - mStartTime) >= mStartDelay) {
-            doStart();
-            return true;
-        }
-        return false;
-    }
-
-    private static AnimationHelper getHelper() {
-        AnimationHelper helper = sAnimationHelper.get();
-        if (helper == null) {
-            helper = new AnimationHelper();
-            sAnimationHelper.set(helper);
-        }
-        return helper;
-    }
-
-    private static ThreadLocal<AnimationHelper> sAnimationHelper =
-            new ThreadLocal<AnimationHelper>();
-
-    private static class AnimationHelper implements Runnable {
-
-        private ArrayList<RenderNodeAnimatorCompat> mDelayedAnims = new ArrayList<RenderNodeAnimatorCompat>();
-        private final Choreographer mChoreographer;
-        private boolean mCallbackScheduled;
-
-        public AnimationHelper() {
-            mChoreographer = Choreographer.getInstance();
-        }
-
-        public void addDelayedAnimation(RenderNodeAnimatorCompat animator) {
-            mDelayedAnims.add(animator);
-            scheduleCallback();
-        }
-
-        private void scheduleCallback() {
-            if (!mCallbackScheduled) {
-                mCallbackScheduled = true;
-                mChoreographer.postCallback(Choreographer.CALLBACK_ANIMATION, this, null);
-            }
-        }
-
-        @Override
-        public void run() {
-            long frameTimeMs = mChoreographer.getFrameTime();
-            mCallbackScheduled = false;
-
-            int end = 0;
-            for (int i = 0; i < mDelayedAnims.size(); i++) {
-                RenderNodeAnimatorCompat animator = mDelayedAnims.get(i);
-                if (!animator.processDelayed(frameTimeMs)) {
-                    if (end != i) {
-                        mDelayedAnims.set(end, animator);
-                    }
-                    end++;
-                }
-            }
-            while (mDelayedAnims.size() > end) {
-                mDelayedAnims.remove(mDelayedAnims.size() - 1);
-            }
-
-            if (mDelayedAnims.size() > 0) {
-                scheduleCallback();
-            }
-        }
-    }
-}
diff --git a/core/java/android/view/ViewAnimationUtils.java b/core/java/android/view/ViewAnimationUtils.java
index ea3efb1..eeff90a 100644
--- a/core/java/android/view/ViewAnimationUtils.java
+++ b/core/java/android/view/ViewAnimationUtils.java
@@ -30,6 +30,9 @@
      *
      * Any shadow cast by the View will respect the circular clip from this animator.
      *
+     * Note that the animation returned here is a one-shot animation. It cannot
+     * be re-used, and once started it cannot be paused or resumed.
+     *
      * @param view The View will be clipped to the animating circle.
      * @param centerX The x coordinate of the center of the animating circle.
      * @param centerY The y coordinate of the center of the animating circle.
diff --git a/core/java/android/view/ViewPropertyAnimatorRT.java b/core/java/android/view/ViewPropertyAnimatorRT.java
index 20f5182..de96887 100644
--- a/core/java/android/view/ViewPropertyAnimatorRT.java
+++ b/core/java/android/view/ViewPropertyAnimatorRT.java
@@ -81,7 +81,7 @@
             int property = RenderNodeAnimator.mapViewPropertyToRenderProperty(holder.mNameConstant);
 
             final float finalValue = holder.mFromValue + holder.mDeltaValue;
-            RenderNodeAnimator animator = new RenderNodeAnimatorCompat(property, finalValue);
+            RenderNodeAnimator animator = new RenderNodeAnimator(property, finalValue);
             animator.setStartDelay(startDelay);
             animator.setDuration(duration);
             animator.setInterpolator(interpolator);
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index a82fa65..096fe88 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -2867,8 +2867,15 @@
     }
 
     /**
-     * Gives the text a shadow of the specified radius and color, the specified
-     * distance from its normal position.
+     * Gives the text a shadow of the specified blur radius and color, the specified
+     * distance from its drawn position.
+     * <p>
+     * The text shadow produced does not interact with the properties on view
+     * that are responsible for real time shadows,
+     * {@link View#getElevation() elevation} and
+     * {@link View#getTranslationZ() translationZ}.
+     *
+     * @see Paint#setShadowLayer(float, float, float, int)
      *
      * @attr ref android.R.styleable#TextView_shadowColor
      * @attr ref android.R.styleable#TextView_shadowDx
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index ece3e9d..74b1fdd 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -1093,6 +1093,25 @@
      */
     public void setVisiblePatternEnabled(boolean enabled) {
         setBoolean(Settings.Secure.LOCK_PATTERN_VISIBLE, enabled);
+
+        // Update for crypto if owner
+        int userId = getCurrentOrCallingUserId();
+        if (userId != UserHandle.USER_OWNER) {
+            return;
+        }
+
+        IBinder service = ServiceManager.getService("mount");
+        if (service == null) {
+            Log.e(TAG, "Could not find the mount service to update the user info");
+            return;
+        }
+
+        IMountService mountService = IMountService.Stub.asInterface(service);
+        try {
+            mountService.setField("PatternVisible", enabled ? "1" : "0");
+        } catch (RemoteException e) {
+            Log.e(TAG, "Error changing pattern visible state", e);
+        }
     }
 
     /**
diff --git a/core/res/res/drawable-hdpi/title_bar_shadow.9.png b/core/res/res/drawable-hdpi/title_bar_shadow.9.png
deleted file mode 100644
index e6dab63..0000000
--- a/core/res/res/drawable-hdpi/title_bar_shadow.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/title_bar_shadow.9.png b/core/res/res/drawable-mdpi/title_bar_shadow.9.png
deleted file mode 100644
index dbcefee..0000000
--- a/core/res/res/drawable-mdpi/title_bar_shadow.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/title_bar_shadow.9.png b/core/res/res/drawable-xhdpi/title_bar_shadow.9.png
deleted file mode 100644
index 45b5456..0000000
--- a/core/res/res/drawable-xhdpi/title_bar_shadow.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable/notification_icon_legacy_bg_inset.xml b/core/res/res/drawable/title_bar_shadow.xml
similarity index 69%
rename from core/res/res/drawable/notification_icon_legacy_bg_inset.xml
rename to core/res/res/drawable/title_bar_shadow.xml
index 96c5573..37b0b8f 100644
--- a/core/res/res/drawable/notification_icon_legacy_bg_inset.xml
+++ b/core/res/res/drawable/title_bar_shadow.xml
@@ -14,8 +14,12 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License
   -->
-
-<inset xmlns:android="http://schemas.android.com/apk/res/android"
-       android:drawable="@drawable/notification_icon_legacy_bg" android:insetBottom="8dp"
-       android:insetLeft="8dp" android:insetRight="8dp" android:insetTop="8dp"
-       android:visible="true"/>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <gradient
+        android:startColor="#44000000"
+        android:centerColor="#1C000000"
+        android:endColor="#00000000"
+        android:centerY="0.3"
+        android:centerX="0.5"
+        android:angle="270"/>
+</shape>
\ No newline at end of file
diff --git a/core/res/res/layout/notification_material_action.xml b/core/res/res/layout/notification_material_action.xml
index 8f8c4fb..637d941 100644
--- a/core/res/res/layout/notification_material_action.xml
+++ b/core/res/res/layout/notification_material_action.xml
@@ -25,8 +25,8 @@
     android:gravity="start|center_vertical"
     android:drawablePadding="8dp"
     android:paddingStart="8dp"
-    android:textColor="#555555"
-    android:textSize="@dimen/notification_text_size"
+    android:textColor="@color/secondary_text_material_light"
+    android:textSize="13sp"
     android:singleLine="true"
     android:ellipsize="end"
     />
diff --git a/core/res/res/layout/notification_material_action_list.xml b/core/res/res/layout/notification_material_action_list.xml
index ec4919b..2a36949 100644
--- a/core/res/res/layout/notification_material_action_list.xml
+++ b/core/res/res/layout/notification_material_action_list.xml
@@ -22,9 +22,6 @@
     android:orientation="horizontal"
     android:visibility="gone"
     android:layout_marginBottom="8dp"
-    android:showDividers="middle"
-    android:divider="@drawable/list_divider_holo_light"
-    android:dividerPadding="12dp"
     >
     <!-- actions will be added here -->
 </LinearLayout>
diff --git a/core/res/res/layout/notification_template_icon_group.xml b/core/res/res/layout/notification_template_icon_group.xml
index 2ad6f9e..fa66163 100644
--- a/core/res/res/layout/notification_template_icon_group.xml
+++ b/core/res/res/layout/notification_template_icon_group.xml
@@ -23,20 +23,23 @@
     android:id="@+id/icon_group"
     >
     <ImageView android:id="@+id/icon"
-        android:layout_width="@dimen/notification_large_icon_width"
-        android:layout_height="@dimen/notification_large_icon_height"
-        android:padding="8dp"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_marginTop="12dp"
+        android:layout_marginBottom="12dp"
+        android:layout_marginStart="12dp"
+        android:layout_marginEnd="12dp"
         android:scaleType="centerInside"
         />
     <ImageView android:id="@+id/right_icon"
-        android:layout_width="24dp"
-        android:layout_height="24dp"
-        android:padding="4dp"
+        android:layout_width="16dp"
+        android:layout_height="16dp"
+        android:padding="3dp"
         android:layout_gravity="end|bottom"
         android:scaleType="centerInside"
         android:visibility="gone"
-        android:layout_marginEnd="3dp"
-        android:layout_marginBottom="3dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginBottom="8dp"
         />
 </FrameLayout>
 
diff --git a/core/res/res/layout/notification_template_material_base.xml b/core/res/res/layout/notification_template_material_base.xml
index 5e51db9..674d7b8 100644
--- a/core/res/res/layout/notification_template_material_base.xml
+++ b/core/res/res/layout/notification_template_material_base.xml
@@ -31,25 +31,12 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_gravity="top"
-        android:layout_marginEnd="8dp"
         android:layout_marginStart="@dimen/notification_large_icon_width"
         android:minHeight="@dimen/notification_large_icon_height"
         android:orientation="vertical"
         >
-        <include layout="@layout/notification_template_part_line1"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            />
-        <include layout="@layout/notification_template_part_line2"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            />
-        <include layout="@layout/notification_template_part_line3"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            />
+        <include layout="@layout/notification_template_part_line1" />
+        <include layout="@layout/notification_template_part_line2" />
+        <include layout="@layout/notification_template_part_line3" />
     </LinearLayout>
 </FrameLayout>
diff --git a/core/res/res/layout/notification_template_material_big_base.xml b/core/res/res/layout/notification_template_material_big_base.xml
index 2243a09..3d8a527 100644
--- a/core/res/res/layout/notification_template_material_big_base.xml
+++ b/core/res/res/layout/notification_template_material_big_base.xml
@@ -31,7 +31,6 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_gravity="top"
-        android:layout_marginEnd="8dp"
         android:layout_marginStart="@dimen/notification_large_icon_width"
         android:minHeight="@dimen/notification_large_icon_height"
         android:orientation="vertical"
@@ -42,22 +41,26 @@
             android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:minHeight="@dimen/notification_large_icon_height"
-            android:layout_weight="1"
+            android:layout_marginEnd="8dp"
             android:singleLine="false"
             android:visibility="gone"
             />
-        <include layout="@layout/notification_template_part_line3" />
+        <include
+            layout="@layout/notification_template_part_line3"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginEnd="8dp"
+            />
         <ImageView
             android:layout_width="match_parent"
             android:layout_height="1dp"
+            android:layout_marginTop="10dp"
             android:id="@+id/action_divider"
             android:visibility="gone"
-            android:background="@drawable/list_divider_holo_light" />
+            android:background="@drawable/notification_template_divider" />
         <include
             layout="@layout/notification_material_action_list"
-            android:layout_marginLeft="-8dp"
-            android:layout_marginRight="-8dp"
+            android:layout_marginStart="-8dp"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             />
diff --git a/core/res/res/layout/notification_template_material_big_text.xml b/core/res/res/layout/notification_template_material_big_text.xml
new file mode 100644
index 0000000..36f8701
--- /dev/null
+++ b/core/res/res/layout/notification_template_material_big_text.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ 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
+  -->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:internal="http://schemas.android.com/apk/prv/res/android"
+    android:id="@+id/status_bar_latest_event_content"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    internal:layout_minHeight="65dp"
+    internal:layout_maxHeight="unbounded"
+    >
+    <include layout="@layout/notification_template_icon_group"
+        android:layout_width="@dimen/notification_large_icon_width"
+        android:layout_height="@dimen/notification_large_icon_height"
+        />
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="top"
+        android:layout_marginStart="@dimen/notification_large_icon_width"
+        android:minHeight="@dimen/notification_large_icon_height"
+        android:orientation="vertical"
+        >
+        <include layout="@layout/notification_template_part_line1" />
+        <include layout="@layout/notification_template_part_line2" />
+        <TextView android:id="@+id/big_text"
+            android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginEnd="8dp"
+            android:layout_marginBottom="10dp"
+            android:visibility="gone"
+            />
+        <ImageView
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:id="@+id/action_divider"
+            android:visibility="gone"
+            android:background="@drawable/notification_template_divider" />
+        <include
+            layout="@layout/notification_material_action_list"
+            android:layout_marginStart="-8dp"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            />
+        <ImageView
+            android:layout_width="match_parent"
+            android:layout_height="1dip"
+            android:id="@+id/overflow_divider"
+            android:visibility="visible"
+            android:background="@drawable/notification_template_divider" />
+        <include
+            layout="@layout/notification_template_part_line3"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginEnd="8dp"
+            android:layout_marginTop="8dp"
+            android:layout_marginBottom="10dp" />
+    </LinearLayout>
+</FrameLayout>
diff --git a/core/res/res/layout/notification_template_material_inbox.xml b/core/res/res/layout/notification_template_material_inbox.xml
index 6133791..ef6cbd0 100644
--- a/core/res/res/layout/notification_template_material_inbox.xml
+++ b/core/res/res/layout/notification_template_material_inbox.xml
@@ -113,7 +113,7 @@
         <FrameLayout
             android:id="@+id/inbox_end_pad"
             android:layout_width="match_parent"
-            android:layout_height="8dip"
+            android:layout_height="10dp"
             android:visibility="gone"
             android:layout_weight="0"
         />
@@ -122,7 +122,7 @@
             android:layout_height="1dip"
             android:id="@+id/action_divider"
             android:visibility="gone"
-            android:background="@drawable/list_divider_holo_light" />
+            android:background="@drawable/notification_template_divider" />
         <include
             layout="@layout/notification_material_action_list"
             android:layout_width="match_parent"
@@ -136,7 +136,13 @@
             android:layout_height="1dip"
             android:id="@+id/overflow_divider"
             android:visibility="visible"
-            android:background="@drawable/list_divider_holo_light" />
-        <include layout="@layout/notification_template_part_line3" />
+            android:background="@drawable/notification_template_divider" />
+        <include
+            layout="@layout/notification_template_part_line3"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginEnd="8dp"
+            android:layout_marginTop="8dp"
+            android:layout_marginBottom="10dp" />
     </LinearLayout>
 </FrameLayout>
diff --git a/core/res/res/layout/notification_template_part_line1.xml b/core/res/res/layout/notification_template_part_line1.xml
index d652959..c6ea6bf 100644
--- a/core/res/res/layout/notification_template_part_line1.xml
+++ b/core/res/res/layout/notification_template_part_line1.xml
@@ -19,9 +19,8 @@
     android:id="@+id/line1"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:layout_marginEnd="8dp"
     android:orientation="horizontal"
-    android:paddingTop="@dimen/notification_vert_pad"
-    android:layout_weight="0"
     >
     <TextView android:id="@+id/title"
         android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Title"
diff --git a/core/res/res/layout/notification_template_part_line2.xml b/core/res/res/layout/notification_template_part_line2.xml
index 1e19df1..d3f202f 100644
--- a/core/res/res/layout/notification_template_part_line2.xml
+++ b/core/res/res/layout/notification_template_part_line2.xml
@@ -21,8 +21,9 @@
         android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Line2"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginTop="-2dp"
-        android:layout_marginBottom="-2dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginTop="-1dp"
+        android:layout_marginBottom="-1dp"
         android:singleLine="true"
         android:fadingEdge="horizontal"
         android:ellipsize="marquee"
@@ -32,7 +33,8 @@
     <ProgressBar
         android:id="@android:id/progress"
         android:layout_width="match_parent"
-        android:layout_height="8dp"
+        android:layout_height="15dp"
+        android:layout_marginEnd="8dp"
         android:visibility="gone"
         android:layout_weight="0"
         style="@style/Widget.Material.Light.ProgressBar.Horizontal"
diff --git a/core/res/res/layout/notification_template_part_line3.xml b/core/res/res/layout/notification_template_part_line3.xml
index 2c8c704c..dd2779d 100644
--- a/core/res/res/layout/notification_template_part_line3.xml
+++ b/core/res/res/layout/notification_template_part_line3.xml
@@ -19,10 +19,9 @@
     android:id="@+id/line3"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:layout_marginEnd="8dp"
     android:orientation="horizontal"
-    android:layout_weight="0"
     android:gravity="center_vertical"
-    android:paddingBottom="@dimen/notification_vert_pad"
     >
     <TextView android:id="@+id/text"
         android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index ed9e83f..b00d7e8 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -3799,13 +3799,17 @@
         <attr name="textColorLink" />
         <!-- Present the text in ALL CAPS. This may use a small-caps form when available. -->
         <attr name="textAllCaps" format="boolean" />
-        <!-- Place a shadow of the specified color behind the text. -->
+        <!-- Place a blurred shadow of text underneath the text, drawn with the
+             specified color. The text shadow produced does not interact with
+             properties on View that are responsible for real time shadows,
+             {@link android.R.styleable#View_elevation elevation} and
+             {@link android.R.styleable#View_translationZ translationZ}. -->
         <attr name="shadowColor" format="color" />
-        <!-- Horizontal offset of the shadow. -->
+        <!-- Horizontal offset of the text shadow. -->
         <attr name="shadowDx" format="float" />
-        <!-- Vertical offset of the shadow. -->
+        <!-- Vertical offset of the text shadow. -->
         <attr name="shadowDy" format="float" />
-        <!-- Radius of the shadow. -->
+        <!-- Blur radius of the text shadow. -->
         <attr name="shadowRadius" format="float" />
         <!-- Elegant text height, especially for less compacted complex script text. -->
         <attr name="elegantTextHeight" format="boolean" />
@@ -3946,13 +3950,17 @@
         <!-- Set an input filter to constrain the text length to the
              specified number. -->
         <attr name="maxLength" format="integer" min="0" />
-        <!-- Place a shadow of the specified color behind the text. -->
+        <!-- Place a blurred shadow of text underneath the text, drawn with the
+             specified color. The text shadow produced does not interact with
+             properties on View that are responsible for real time shadows,
+             {@link android.R.styleable#View_elevation elevation} and
+             {@link android.R.styleable#View_translationZ translationZ}. -->
         <attr name="shadowColor" />
-        <!-- Horizontal offset of the shadow. -->
+        <!-- Horizontal offset of the text shadow. -->
         <attr name="shadowDx" />
-        <!-- Vertical offset of the shadow. -->
+        <!-- Vertical offset of the text shadow. -->
         <attr name="shadowDy" />
-        <!-- Radius of the shadow. -->
+        <!-- Blur radius of the text shadow. -->
         <attr name="shadowRadius" />
         <attr name="autoLink" />
         <!-- If set to false, keeps the movement method from being set
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index d538352..0360460 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -127,6 +127,7 @@
 
     <drawable name="notification_template_icon_bg">#3333B5E5</drawable>
     <drawable name="notification_template_icon_low_bg">#0cffffff</drawable>
+    <drawable name="notification_template_divider">#29000000</drawable>
 
     <color name="notification_icon_bg_color">#ff9e9e9e</color>
     <color name="notification_action_legacy_color_filter">#ff555555</color>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index e58bc6f..6022bdc 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -215,17 +215,26 @@
     <dimen name="action_bar_stacked_tab_max_width">180dp</dimen>
 
     <!-- Size of notification text (see TextAppearance.StatusBar.EventContent) -->
-    <dimen name="notification_text_size">13sp</dimen>
+    <dimen name="notification_text_size">14sp</dimen>
     <!-- Size of notification text titles (see TextAppearance.StatusBar.EventContent.Title) -->
     <dimen name="notification_title_text_size">16sp</dimen>
     <!-- Size of smaller notification text (see TextAppearance.StatusBar.EventContent.Line2, Info, Time) -->
     <dimen name="notification_subtext_size">12sp</dimen>
 
-    <!-- 8dp at the top/bottom of the notification view -->
-    <dimen name="notification_vert_pad">10dp</dimen>
+    <!-- Top padding for notifications in the standard layout. -->
+    <dimen name="notification_top_pad">10dp</dimen>
 
-    <!-- Replacement for @dimen/notification_vert_pad when the text is large -->
-    <dimen name="notification_large_font_vert_pad">3dp</dimen>
+    <!-- Top padding for notifications when narrow (i.e. it has 3 lines) -->
+    <dimen name="notification_top_pad_narrow">4dp</dimen>
+
+    <!-- Top padding for notification when text is large -->
+    <dimen name="notification_top_pad_large_text">5dp</dimen>
+
+    <!-- Top padding for notification when text is large and narrow (i.e. it has 3 lines -->
+    <dimen name="notification_top_pad_large_text_narrow">-4dp</dimen>
+
+    <!-- Padding for notification icon when drawn with circle around it -->
+    <dimen name="notification_large_icon_circle_padding">11dp</dimen>
 
     <!-- Keyguard dimensions -->
     <!-- TEMP -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 8912c92..b198329 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4859,15 +4859,12 @@
     <!-- Exting lock-to-app indication. -->
     <string name="lock_to_app_exit">Screen unpinned</string>
 
-    <!-- Lock-to-app checkbox for lock on exit -->
-    <string name="lock_to_app_use_screen_lock">Ask for %1$s before unpinning</string>
-
     <!-- Lock-to-app unlock pin string -->
-    <string name="lock_to_app_unlock_pin">PIN</string>
+    <string name="lock_to_app_unlock_pin">Ask for PIN before unpinning</string>
     <!-- Lock-to-app unlock pattern string -->
-    <string name="lock_to_app_unlock_pattern">unlock pattern</string>
+    <string name="lock_to_app_unlock_pattern">Ask for unlock pattern before unpinning</string>
     <!-- Lock-to-app unlock password string -->
-    <string name="lock_to_app_unlock_password">password</string>
+    <string name="lock_to_app_unlock_password">Ask for password before unpinning</string>
 
     <!-- [CHAR_LIMIT=NONE] Battery saver: Feature description -->
     <string name="battery_saver_description">To help improve battery life, battery saver reduces your device’s performance and limits vibration and most background data. Email, messaging, and other apps that rely on syncing may not update unless you open them.\n\nBattery saver turns off automatically when your device is charging</string>
diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml
index c8ea699..fb70d6b 100644
--- a/core/res/res/values/styles_material.xml
+++ b/core/res/res/values/styles_material.xml
@@ -413,12 +413,12 @@
     <style name="TextAppearance.StatusBar.Material" />
 
     <style name="TextAppearance.StatusBar.Material.EventContent">
-        <item name="textColor">#90000000</item>
+        <item name="textColor">@color/secondary_text_material_light</item>
         <item name="textSize">@dimen/notification_text_size</item>
     </style>
 
     <style name="TextAppearance.StatusBar.Material.EventContent.Title">
-        <item name="textColor">#DD000000</item>
+        <item name="textColor">@color/primary_text_default_material_light</item>
         <item name="textSize">@dimen/notification_title_text_size</item>
     </style>
 
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 1f862fd..af73c02 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -350,7 +350,11 @@
   <java-symbol type="dimen" name="notification_text_size" />
   <java-symbol type="dimen" name="notification_title_text_size" />
   <java-symbol type="dimen" name="notification_subtext_size" />
-  <java-symbol type="dimen" name="notification_large_font_vert_pad" />
+  <java-symbol type="dimen" name="notification_top_pad" />
+  <java-symbol type="dimen" name="notification_top_pad_narrow" />
+  <java-symbol type="dimen" name="notification_top_pad_large_text" />
+  <java-symbol type="dimen" name="notification_top_pad_large_text_narrow" />
+  <java-symbol type="dimen" name="notification_large_icon_circle_padding" />
   <java-symbol type="dimen" name="immersive_mode_cling_width" />
   <java-symbol type="dimen" name="circular_display_mask_offset" />
 
@@ -622,7 +626,6 @@
   <java-symbol type="id" name="lock_to_app_checkbox" />
   <java-symbol type="string" name="lock_to_app_start" />
   <java-symbol type="string" name="lock_to_app_exit" />
-  <java-symbol type="string" name="lock_to_app_use_screen_lock" />
   <java-symbol type="string" name="lock_to_app_unlock_pin" />
   <java-symbol type="string" name="lock_to_app_unlock_pattern" />
   <java-symbol type="string" name="lock_to_app_unlock_password" />
@@ -1705,12 +1708,12 @@
   <java-symbol type="layout" name="notification_template_material_inbox" />
   <java-symbol type="layout" name="notification_template_material_media" />
   <java-symbol type="layout" name="notification_template_material_big_media" />
+  <java-symbol type="layout" name="notification_template_material_big_text" />
   <java-symbol type="layout" name="notification_template_icon_group" />
   <java-symbol type="layout" name="notification_material_media_action" />
   <java-symbol type="color" name="notification_action_legacy_color_filter" />
   <java-symbol type="color" name="notification_icon_bg_color" />
   <java-symbol type="drawable" name="notification_icon_legacy_bg" />
-  <java-symbol type="drawable" name="notification_icon_legacy_bg_inset" />
   <java-symbol type="drawable" name="notification_material_media_progress" />
   <java-symbol type="color" name="notification_media_action_bg" />
   <java-symbol type="color" name="notification_media_progress" />
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
index 06586ca..568d3f2 100644
--- a/graphics/java/android/graphics/Typeface.java
+++ b/graphics/java/android/graphics/Typeface.java
@@ -188,7 +188,7 @@
                 return createFromFamiliesWithDefault(families);
             }
         }
-        return null;
+        throw new RuntimeException("Font asset not found " + path);
     }
 
     /**
@@ -215,7 +215,7 @@
                 return createFromFamiliesWithDefault(families);
             }
         }
-        return null;
+        throw new RuntimeException("Font not found " + path);
     }
 
     /**
diff --git a/media/java/android/media/RemoteControlClient.java b/media/java/android/media/RemoteControlClient.java
index 2a0fd83..1c8d3cc 100644
--- a/media/java/android/media/RemoteControlClient.java
+++ b/media/java/android/media/RemoteControlClient.java
@@ -389,6 +389,9 @@
     public void registerWithSession(MediaSessionLegacyHelper helper) {
         helper.addRccListener(mRcMediaIntent, mTransportListener);
         mSession = helper.getSession(mRcMediaIntent);
+        if (mTransportControlFlags != 0) {
+            setTransportControlFlags(mTransportControlFlags);
+        }
     }
 
     /**
diff --git a/media/java/android/media/tv/TvInputInfo.java b/media/java/android/media/tv/TvInputInfo.java
index 3f5697f..106e1dc 100644
--- a/media/java/android/media/tv/TvInputInfo.java
+++ b/media/java/android/media/tv/TvInputInfo.java
@@ -46,7 +46,6 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -616,11 +615,15 @@
         public static Set<String> getHiddenTvInputIds(Context context, int userId) {
             String hiddenIdsString = Settings.Secure.getStringForUser(
                     context.getContentResolver(), Settings.Secure.TV_INPUT_HIDDEN_INPUTS, userId);
+            Set<String> set = new HashSet<String>();
             if (TextUtils.isEmpty(hiddenIdsString)) {
-                return new HashSet<String>();
+                return set;
             }
             String[] ids = hiddenIdsString.split(TV_INPUT_SEPARATOR);
-            return new HashSet<>(Arrays.asList(ids));
+            for (String id : ids) {
+                set.add(Uri.decode(id));
+            }
+            return set;
         }
 
         /**
@@ -641,7 +644,7 @@
             String[] pairs = labelsString.split(TV_INPUT_SEPARATOR);
             for (String pairString : pairs) {
                 String[] pair = pairString.split(CUSTOM_NAME_SEPARATOR);
-                map.put(pair[0], pair[1]);
+                map.put(Uri.decode(pair[0]), Uri.decode(pair[1]));
             }
             return map;
         }
@@ -667,7 +670,7 @@
                 } else {
                     builder.append(TV_INPUT_SEPARATOR);
                 }
-                builder.append(inputId);
+                builder.append(Uri.encode(inputId));
             }
             Settings.Secure.putStringForUser(context.getContentResolver(),
                     Settings.Secure.TV_INPUT_HIDDEN_INPUTS, builder.toString(), userId);
@@ -695,9 +698,9 @@
                 } else {
                     builder.append(TV_INPUT_SEPARATOR);
                 }
-                builder.append(entry.getKey());
+                builder.append(Uri.encode(entry.getKey()));
                 builder.append(CUSTOM_NAME_SEPARATOR);
-                builder.append(entry.getValue());
+                builder.append(Uri.encode(entry.getValue()));
             }
             Settings.Secure.putStringForUser(context.getContentResolver(),
                     Settings.Secure.TV_INPUT_CUSTOM_LABELS, builder.toString(), userId);
@@ -707,14 +710,6 @@
             if (TextUtils.isEmpty(value)) {
                 throw new IllegalArgumentException(value + " should not empty ");
             }
-            if (value.contains(TV_INPUT_SEPARATOR)) {
-                throw new IllegalArgumentException(value + " should not include "
-                        + TV_INPUT_SEPARATOR);
-            }
-            if (value.contains(CUSTOM_NAME_SEPARATOR)) {
-                throw new IllegalArgumentException(value + " should not include "
-                        + CUSTOM_NAME_SEPARATOR);
-            }
         }
     }
 }
diff --git a/packages/SystemUI/res/drawable-xxhdpi/title_bar_shadow.9.png b/packages/SystemUI/res/drawable-xxhdpi/title_bar_shadow.9.png
deleted file mode 100644
index e86f891..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/title_bar_shadow.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable/ic_qs_vpn.xml b/packages/SystemUI/res/drawable/ic_qs_vpn.xml
index e9141ef..e7ef02a 100644
--- a/packages/SystemUI/res/drawable/ic_qs_vpn.xml
+++ b/packages/SystemUI/res/drawable/ic_qs_vpn.xml
@@ -18,8 +18,7 @@
         android:height="12.0dp"
         android:viewportWidth="24.0"
         android:viewportHeight="24.0">
-
     <path
         android:fillColor="#4DFFFFFF"
-        android:pathData="M22.000000,4.000000L22.000000,3.500000C22.000000,2.100000 20.900000,1.000000 19.500000,1.000000C18.100000,1.000000 17.000000,2.100000 17.000000,3.500000L17.000000,4.000000c-0.600000,0.000000 -1.000000,0.400000 -1.000000,1.000000l0.000000,4.000000c0.000000,0.600000 0.400000,1.000000 1.000000,1.000000l5.000000,0.000000c0.600000,0.000000 1.000000,-0.400000 1.000000,-1.000000L23.000000,5.000000C23.000000,4.400000 22.600000,4.000000 22.000000,4.000000zM21.200001,4.000000l-3.400000,0.000000L17.800001,3.500000c0.000000,-0.900000 0.800000,-1.700000 1.700000,-1.700000c0.900000,0.000000 1.700000,0.800000 1.700000,1.700000L21.200003,4.000000zM18.900000,12.000000c0.000000,0.300000 0.100000,0.700000 0.100000,1.000000c0.000000,2.100000 -0.800000,4.000000 -2.100000,5.400000c-0.300000,-0.800000 -1.000000,-1.400000 -1.900000,-1.400000l-1.000000,0.000000l0.000000,-3.000000c0.000000,-0.600000 -0.400000,-1.000000 -1.000000,-1.000000L7.000000,13.000000l0.000000,-2.000000l2.000000,0.000000c0.600000,0.000000 1.000000,-0.400000 1.000000,-1.000000L10.000000,8.000000l2.000000,0.000000c1.100000,0.000000 2.000000,-0.900000 2.000000,-2.000000L14.000000,3.500000C13.100000,3.200000 12.000000,3.000000 11.000000,3.000000C5.500000,3.000000 1.000000,7.500000 1.000000,13.000000c0.000000,5.500000 4.500000,10.000000 10.000000,10.000000c5.500000,0.000000 10.000000,-4.500000 10.000000,-10.000000c0.000000,-0.300000 0.000000,-0.700000 -0.100000,-1.000000L18.900000,12.000000zM10.000000,20.900000c-3.900000,-0.500000 -7.000000,-3.900000 -7.000000,-7.900000c0.000000,-0.600000 0.100000,-1.200000 0.200000,-1.800000L8.000000,16.000000l0.000000,1.000000c0.000000,1.100000 0.900000,2.000000 2.000000,2.000000L10.000000,20.900000z"/>
+        android:pathData="M12.700000,10.000000c-0.800000,-2.300000 -3.000000,-4.000000 -5.700000,-4.000000c-3.300000,0.000000 -6.000000,2.700000 -6.000000,6.000000s2.700000,6.000000 6.000000,6.000000c2.600000,0.000000 4.800000,-1.700000 5.700000,-4.000000L17.000000,14.000000l0.000000,4.000000l4.000000,0.000000l0.000000,-4.000000l2.000000,0.000000l0.000000,-4.000000L12.700000,10.000000zM7.000000,14.000000c-1.100000,0.000000 -2.000000,-0.900000 -2.000000,-2.000000c0.000000,-1.100000 0.900000,-2.000000 2.000000,-2.000000s2.000000,0.900000 2.000000,2.000000C9.000000,13.100000 8.100000,14.000000 7.000000,14.000000z"/>
 </vector>
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
index fb77751..5390daf 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
@@ -71,6 +71,8 @@
 public class SystemServicesProxy {
     final static String TAG = "SystemServicesProxy";
 
+    final static BitmapFactory.Options sBitmapOptions;
+
     ActivityManager mAm;
     IActivityManager mIam;
     AppWidgetManager mAwm;
@@ -89,6 +91,11 @@
     Paint mBgProtectionPaint;
     Canvas mBgProtectionCanvas;
 
+    static {
+        sBitmapOptions = new BitmapFactory.Options();
+        sBitmapOptions.inMutable = true;
+    }
+
     /** Private constructor */
     public SystemServicesProxy(Context context) {
         mAm = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
@@ -258,7 +265,8 @@
         Bitmap thumbnail = taskThumbnail.mainThumbnail;
         ParcelFileDescriptor descriptor = taskThumbnail.thumbnailFileDescriptor;
         if (thumbnail == null && descriptor != null) {
-            thumbnail = BitmapFactory.decodeFileDescriptor(descriptor.getFileDescriptor());
+            thumbnail = BitmapFactory.decodeFileDescriptor(descriptor.getFileDescriptor(),
+                    null, sBitmapOptions);
         }
         if (descriptor != null) {
             try {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 53bdcbf..3a20b00 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -1183,7 +1183,10 @@
             icon.setImageDrawable(iconDrawable);
             if (mNotificationColorUtil.isGrayscale(iconDrawable)) {
                 icon.setBackgroundResource(
-                        com.android.internal.R.drawable.notification_icon_legacy_bg_inset);
+                        com.android.internal.R.drawable.notification_icon_legacy_bg);
+                int padding = mContext.getResources().getDimensionPixelSize(
+                        com.android.internal.R.dimen.notification_large_icon_circle_padding);
+                icon.setPadding(padding, padding, padding, padding);
             }
 
             if (profileIcon != null) {
@@ -1214,6 +1217,11 @@
                         R.style.TextAppearance_StatusBar_Material_EventContent_Parenthetical);
             }
 
+            int topPadding = Notification.Builder.calculateTopPadding(mContext,
+                    false /* hasThreeLines */,
+                    mContext.getResources().getConfiguration().fontScale);
+            title.setPadding(0, topPadding, 0, 0);
+
             entry.autoRedacted = true;
         }
 
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 96f8324..54afe99 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -2850,11 +2850,13 @@
         enforceConnectivityInternalPermission();
 
         if (TextUtils.isEmpty(iface)) return ConnectivityManager.TYPE_NONE;
-        for (NetworkStateTracker tracker : mNetTrackers) {
-            if (tracker != null) {
-                LinkProperties lp = tracker.getLinkProperties();
-                if (lp != null && iface.equals(lp.getInterfaceName())) {
-                    return tracker.getNetworkInfo().getType();
+
+        synchronized(mNetworkForNetId) {
+            for (int i = 0; i < mNetworkForNetId.size(); i++) {
+                NetworkAgentInfo nai = mNetworkForNetId.valueAt(i);
+                LinkProperties lp = nai.linkProperties;
+                if (lp != null && iface.equals(lp.getInterfaceName()) && nai.networkInfo != null) {
+                    return nai.networkInfo.getType();
                 }
             }
         }
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index b1d84f58..e8b1d03 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -40,6 +40,9 @@
 import android.app.usage.UsageEvents;
 import android.app.usage.UsageStatsManagerInternal;
 import android.appwidget.AppWidgetManager;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.Point;
 import android.graphics.Rect;
 import android.os.BatteryStats;
 import android.os.PersistableBundle;
@@ -261,6 +264,7 @@
     static final boolean DEBUG_VISBILITY = localLOGV || false;
     static final boolean DEBUG_PSS = localLOGV || false;
     static final boolean DEBUG_LOCKSCREEN = localLOGV || false;
+    static final boolean DEBUG_RECENTS = localLOGV || false;
     static final boolean VALIDATE_TOKENS = false;
     static final boolean SHOW_ACTIVITY_START_TIME = true;
 
@@ -410,6 +414,21 @@
     ArrayList<TaskRecord> mRecentTasks;
     ArraySet<TaskRecord> mTmpRecents = new ArraySet<TaskRecord>();
 
+    /**
+     * For addAppTask: cached of the last activity component that was added.
+     */
+    ComponentName mLastAddedTaskComponent;
+
+    /**
+     * For addAppTask: cached of the last activity uid that was added.
+     */
+    int mLastAddedTaskUid;
+
+    /**
+     * For addAppTask: cached of the last ActivityInfo that was added.
+     */
+    ActivityInfo mLastAddedTaskActivity;
+
     public class PendingAssistExtras extends Binder implements Runnable {
         public final ActivityRecord activity;
         public boolean haveResult = false;
@@ -1181,6 +1200,9 @@
     /** Flag whether the device has a recents UI */
     final boolean mHasRecents;
 
+    final int mThumbnailWidth;
+    final int mThumbnailHeight;
+
     final ServiceThread mHandlerThread;
     final MainHandler mHandler;
 
@@ -2229,8 +2251,10 @@
         mConfigurationSeq = mConfiguration.seq = 1;
         mProcessCpuTracker.init();
 
-        mHasRecents = mContext.getResources().getBoolean(
-                com.android.internal.R.bool.config_hasRecents);
+        final Resources res = mContext.getResources();
+        mHasRecents = res.getBoolean(com.android.internal.R.bool.config_hasRecents);
+        mThumbnailWidth = res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_width);
+        mThumbnailHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_height);
 
         mCompatModePackages = new CompatModePackages(this, systemDir, mHandler);
         mIntentFirewall = new IntentFirewall(new IntentFirewallInterface(), mHandler);
@@ -3781,7 +3805,7 @@
     }
 
     final void addRecentTaskLocked(TaskRecord task) {
-        int N = mRecentTasks.size();
+        final int N = mRecentTasks.size();
         // Quick case: check if the top-most recent task is the same.
         if (N > 0 && mRecentTasks.get(0) == task) {
             return;
@@ -3790,10 +3814,25 @@
         if (task.voiceSession != null) {
             return;
         }
-        // Remove any existing entries that are the same kind of task.
+
+        trimRecentsForTask(task, true);
+
+        if (N >= MAX_RECENT_TASKS) {
+            final TaskRecord tr = mRecentTasks.remove(N - 1);
+            tr.disposeThumbnail();
+            tr.closeRecentsChain();
+        }
+        mRecentTasks.add(0, task);
+    }
+
+    /**
+     * If needed, remove oldest existing entries in recents that are for the same kind
+     * of task as the given one.
+     */
+    int trimRecentsForTask(TaskRecord task, boolean doTrim) {
+        int N = mRecentTasks.size();
         final Intent intent = task.intent;
         final boolean document = intent != null && intent.isDocument();
-        final ComponentName comp = intent.getComponent();
 
         int maxRecents = task.maxRecents - 1;
         for (int i=0; i<N; i++) {
@@ -3825,6 +3864,12 @@
                 }
             }
 
+            if (!doTrim) {
+                // If the caller is not actually asking for a trim, just tell them we reached
+                // a point where the trim would happen.
+                return i;
+            }
+
             // Either task and tr are the same or, their affinities match or their intents match
             // and neither of them is a document, or they are documents using the same activity
             // and their maxRecents has been reached.
@@ -3842,12 +3887,8 @@
             }
             notifyTaskPersisterLocked(tr, false);
         }
-        if (N >= MAX_RECENT_TASKS) {
-            final TaskRecord tr = mRecentTasks.remove(N - 1);
-            tr.disposeThumbnail();
-            tr.closeRecentsChain();
-        }
-        mRecentTasks.add(0, task);
+
+        return -1;
     }
 
     @Override
@@ -7639,7 +7680,10 @@
             for (int i=0; i<N && maxNum > 0; i++) {
                 TaskRecord tr = mRecentTasks.get(i);
                 // Only add calling user or related users recent tasks
-                if (!includedUsers.contains(Integer.valueOf(tr.userId))) continue;
+                if (!includedUsers.contains(Integer.valueOf(tr.userId))) {
+                    if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, not user: " + tr);
+                    continue;
+                }
 
                 // Return the entry if desired by the caller.  We always return
                 // the first entry, because callers always expect this to be the
@@ -7656,11 +7700,14 @@
                         // If the caller doesn't have the GET_TASKS permission, then only
                         // allow them to see a small subset of tasks -- their own and home.
                         if (!tr.isHomeTask() && tr.creatorUid != callingUid) {
+                            if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, not allowed: " + tr);
                             continue;
                         }
                     }
                     if (tr.autoRemoveRecents && tr.getTopActivity() == null) {
                         // Don't include auto remove tasks that are finished or finishing.
+                        if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, auto-remove without activity: "
+                                + tr);
                         continue;
                     }
 
@@ -7675,11 +7722,15 @@
                             if (rti.origActivity != null) {
                                 if (pm.getActivityInfo(rti.origActivity, 0, userId)
                                         == null) {
+                                    if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, unavail orig act: "
+                                            + tr);
                                     continue;
                                 }
                             } else if (rti.baseIntent != null) {
                                 if (pm.queryIntentActivities(rti.baseIntent,
                                         null, 0, userId) == null) {
+                                    if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, unavail intent: "
+                                            + tr);
                                     continue;
                                 }
                             }
@@ -7721,6 +7772,97 @@
     }
 
     @Override
+    public int addAppTask(IBinder activityToken, Intent intent,
+            ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
+        final int callingUid = Binder.getCallingUid();
+        final long callingIdent = Binder.clearCallingIdentity();
+
+        try {
+            synchronized (this) {
+                ActivityRecord r = ActivityRecord.isInStackLocked(activityToken);
+                if (r == null) {
+                    throw new IllegalArgumentException("Activity does not exist; token="
+                            + activityToken);
+                }
+                ComponentName comp = intent.getComponent();
+                if (comp == null) {
+                    throw new IllegalArgumentException("Intent " + intent
+                            + " must specify explicit component");
+                }
+                if (thumbnail.getWidth() != mThumbnailWidth
+                        || thumbnail.getHeight() != mThumbnailHeight) {
+                    throw new IllegalArgumentException("Bad thumbnail size: got "
+                            + thumbnail.getWidth() + "x" + thumbnail.getHeight() + ", require "
+                            + mThumbnailWidth + "x" + mThumbnailHeight);
+                }
+                if (intent.getSelector() != null) {
+                    intent.setSelector(null);
+                }
+                if (intent.getSourceBounds() != null) {
+                    intent.setSourceBounds(null);
+                }
+                if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_DOCUMENT) != 0) {
+                    if ((intent.getFlags()&Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS) == 0) {
+                        // The caller has added this as an auto-remove task...  that makes no
+                        // sense, so turn off auto-remove.
+                        intent.addFlags(Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS);
+                    }
+                } else if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0) {
+                    // Must be a new task.
+                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                }
+                if (!comp.equals(mLastAddedTaskComponent) || callingUid != mLastAddedTaskUid) {
+                    mLastAddedTaskActivity = null;
+                }
+                ActivityInfo ainfo = mLastAddedTaskActivity;
+                if (ainfo == null) {
+                    ainfo = mLastAddedTaskActivity = AppGlobals.getPackageManager().getActivityInfo(
+                            comp, 0, UserHandle.getUserId(callingUid));
+                    if (ainfo.applicationInfo.uid != callingUid) {
+                        throw new SecurityException(
+                                "Can't add task for another application: target uid="
+                                + ainfo.applicationInfo.uid + ", calling uid=" + callingUid);
+                    }
+                }
+
+                TaskRecord task = new TaskRecord(this, mStackSupervisor.getNextTaskId(), ainfo,
+                        intent, description);
+
+                int trimIdx = trimRecentsForTask(task, false);
+                if (trimIdx >= 0) {
+                    // If this would have caused a trim, then we'll abort because that
+                    // means it would be added at the end of the list but then just removed.
+                    return -1;
+                }
+
+                final int N = mRecentTasks.size();
+                if (N >= (MAX_RECENT_TASKS-1)) {
+                    final TaskRecord tr = mRecentTasks.remove(N - 1);
+                    tr.disposeThumbnail();
+                    tr.closeRecentsChain();
+                }
+
+                mRecentTasks.add(task);
+                r.task.stack.addTask(task, false, false);
+
+                task.setLastThumbnail(thumbnail);
+                task.freeLastThumbnail();
+
+                return task.taskId;
+            }
+        } finally {
+            Binder.restoreCallingIdentity(callingIdent);
+        }
+    }
+
+    @Override
+    public Point getAppTaskThumbnailSize() {
+        synchronized (this) {
+            return new Point(mThumbnailWidth,  mThumbnailHeight);
+        }
+    }
+
+    @Override
     public void setTaskDescription(IBinder token, ActivityManager.TaskDescription td) {
         synchronized (this) {
             ActivityRecord r = ActivityRecord.isInStackLocked(token);
@@ -18056,14 +18198,16 @@
             mCallingUid = callingUid;
         }
 
+        private void checkCaller() {
+            if (mCallingUid != Binder.getCallingUid()) {
+                throw new SecurityException("Caller " + mCallingUid
+                        + " does not match caller of getAppTasks(): " + Binder.getCallingUid());
+            }
+        }
+
         @Override
         public void finishAndRemoveTask() {
-            // Ensure that we are called from the same process that created this AppTask
-            if (mCallingUid != Binder.getCallingUid()) {
-                Slog.w(TAG, "finishAndRemoveTask: caller " + mCallingUid
-                        + " does not match caller of getAppTasks(): " + Binder.getCallingUid());
-                return;
-            }
+            checkCaller();
 
             synchronized (ActivityManagerService.this) {
                 long origId = Binder.clearCallingIdentity();
@@ -18085,12 +18229,7 @@
 
         @Override
         public ActivityManager.RecentTaskInfo getTaskInfo() {
-            // Ensure that we are called from the same process that created this AppTask
-            if (mCallingUid != Binder.getCallingUid()) {
-                Slog.w(TAG, "finishAndRemoveTask: caller " + mCallingUid
-                        + " does not match caller of getAppTasks(): " + Binder.getCallingUid());
-                return null;
-            }
+            checkCaller();
 
             synchronized (ActivityManagerService.this) {
                 long origId = Binder.clearCallingIdentity();
@@ -18105,5 +18244,28 @@
                 return null;
             }
         }
+
+        @Override
+        public void setExcludeFromRecents(boolean exclude) {
+            checkCaller();
+
+            synchronized (ActivityManagerService.this) {
+                long origId = Binder.clearCallingIdentity();
+                try {
+                    TaskRecord tr = recentTaskForIdLocked(mTaskId);
+                    if (tr != null) {
+                        Intent intent = tr.getBaseIntent();
+                        if (exclude) {
+                            intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+                        } else {
+                            intent.setFlags(intent.getFlags()
+                                    & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+                        }
+                    }
+                } finally {
+                    Binder.restoreCallingIdentity(origId);
+                }
+            }
+        }
     }
 }
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index e309a03..5ad84d4 100755
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -355,8 +355,8 @@
         mCurrentUser = mService.mCurrentUserId;
         // Get the activity screenshot thumbnail dimensions
         Resources res = mService.mContext.getResources();
-        mThumbnailWidth = res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_width);
-        mThumbnailHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_height);
+        mThumbnailWidth = mService.mThumbnailWidth;
+        mThumbnailHeight = mService.mThumbnailHeight;
     }
 
     /**
diff --git a/services/core/java/com/android/server/am/LockTaskNotify.java b/services/core/java/com/android/server/am/LockTaskNotify.java
index cf65243..5768ddb 100644
--- a/services/core/java/com/android/server/am/LockTaskNotify.java
+++ b/services/core/java/com/android/server/am/LockTaskNotify.java
@@ -34,6 +34,7 @@
     private final Context mContext;
     private final H mHandler;
     private AccessibilityManager mAccessibilityManager;
+    private Toast mLastToast;
 
     public LockTaskNotify(Context context) {
         mContext = context;
@@ -52,7 +53,11 @@
         if (!isLocked && mAccessibilityManager.isEnabled()) {
             text = mContext.getString(R.string.lock_to_app_toast_accessible);
         }
-        Toast.makeText(mContext, text, Toast.LENGTH_LONG).show();
+        if (mLastToast != null) {
+            mLastToast.cancel();
+        }
+        mLastToast = Toast.makeText(mContext, text, Toast.LENGTH_LONG);
+        mLastToast.show();
     }
 
     public void show(boolean starting) {
diff --git a/services/core/java/com/android/server/am/LockToAppRequestDialog.java b/services/core/java/com/android/server/am/LockToAppRequestDialog.java
index 12dcf7e..5abf699 100644
--- a/services/core/java/com/android/server/am/LockToAppRequestDialog.java
+++ b/services/core/java/com/android/server/am/LockToAppRequestDialog.java
@@ -102,8 +102,7 @@
         if (unlockStringId != 0) {
             String unlockString = mContext.getString(unlockStringId);
             mCheckbox = (CheckBox) mDialog.findViewById(R.id.lock_to_app_checkbox);
-            mCheckbox.setText(mContext.getString(R.string.lock_to_app_use_screen_lock,
-                    unlockString));
+            mCheckbox.setText(unlockString);
 
             // Remember state.
             try {
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index ccca657..48cb61a 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -167,6 +167,34 @@
         setIntent(_intent, info);
     }
 
+    TaskRecord(ActivityManagerService service, int _taskId, ActivityInfo info, Intent _intent,
+            ActivityManager.TaskDescription _taskDescription) {
+        mService = service;
+        mFilename = String.valueOf(_taskId) + TASK_THUMBNAIL_SUFFIX +
+                TaskPersister.IMAGE_EXTENSION;
+        mLastThumbnailFile = new File(TaskPersister.sImagesDir, mFilename);
+        taskId = _taskId;
+        mAffiliatedTaskId = _taskId;
+        voiceSession = null;
+        voiceInteractor = null;
+        mActivities = new ArrayList<ActivityRecord>();
+        setIntent(_intent, info);
+
+        taskType = ActivityRecord.APPLICATION_ACTIVITY_TYPE;
+        isPersistable = true;
+        mCallingUid = info.applicationInfo.uid;
+        mCallingPackage = info.packageName;
+        // Clamp to [1, 100].
+        maxRecents = Math.min(Math.max(info.maxRecents, 1), 100);
+
+        taskType = APPLICATION_ACTIVITY_TYPE;
+        mTaskToReturnTo = HOME_ACTIVITY_TYPE;
+        userId = UserHandle.getUserId(info.applicationInfo.uid);
+        lastTaskDescription = _taskDescription;
+        mCallingUid = info.applicationInfo.uid;
+        mCallingPackage = info.packageName;
+    }
+
     TaskRecord(ActivityManagerService service, int _taskId, Intent _intent, Intent _affinityIntent,
             String _affinity, ComponentName _realActivity, ComponentName _origActivity,
             boolean _rootWasReset, boolean _autoRemoveRecents, boolean _askedCompatMode,
@@ -765,7 +793,7 @@
     }
 
     void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
-        Slog.i(TAG, "Saving task=" + this);
+        if (ActivityManagerService.DEBUG_RECENTS) Slog.i(TAG, "Saving task=" + this);
 
         out.attribute(null, ATTR_TASKID, String.valueOf(taskId));
         if (realActivity != null) {
@@ -948,18 +976,15 @@
             activities.get(activityNdx).task = task;
         }
 
-        Slog.i(TAG, "Restored task=" + task);
+        if (ActivityManagerService.DEBUG_RECENTS) Slog.d(TAG, "Restored task=" + task);
         return task;
     }
 
     void dump(PrintWriter pw, String prefix) {
-        if (rootWasReset || userId != 0 || numFullscreen != 0) {
-            pw.print(prefix); pw.print(" rootWasReset="); pw.print(rootWasReset);
-                    pw.print(" userId="); pw.print(userId);
-                    pw.print(" taskType="); pw.print(taskType);
-                    pw.print(" numFullscreen="); pw.print(numFullscreen);
-                    pw.print(" mTaskToReturnTo="); pw.println(mTaskToReturnTo);
-        }
+        pw.print(prefix); pw.print("userId="); pw.print(userId);
+                pw.print(" creatorUid="); pw.print(creatorUid);
+                pw.print(" mCallingUid="); pw.print(mCallingUid);
+                pw.print(" mCallingPackage="); pw.println(mCallingPackage);
         if (affinity != null) {
             pw.print(prefix); pw.print("affinity="); pw.println(affinity);
         }
@@ -991,6 +1016,17 @@
             pw.print(prefix); pw.print("realActivity=");
             pw.println(realActivity.flattenToShortString());
         }
+        if (autoRemoveRecents || taskType != 0 || mTaskToReturnTo != 0 || numFullscreen != 0) {
+            pw.print(prefix); pw.print("autoRemoveRecents="); pw.print(autoRemoveRecents);
+                    pw.print(" numFullscreen="); pw.print(numFullscreen);
+                    pw.print(" taskType="); pw.print(taskType);
+                    pw.print(" mTaskToReturnTo="); pw.println(mTaskToReturnTo);
+        }
+        if (rootWasReset || mNeverRelinquishIdentity || mReuseTask) {
+            pw.print(prefix); pw.print("rootWasReset="); pw.print(rootWasReset);
+                    pw.print(" mNeverRelinquishIdentity="); pw.print(mNeverRelinquishIdentity);
+                    pw.print(" mReuseTask="); pw.println(mReuseTask);
+        }
         pw.print(prefix); pw.print("Activities="); pw.println(mActivities);
         if (!askedCompatMode) {
             pw.print(prefix); pw.print("askedCompatMode="); pw.println(askedCompatMode);
diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java
index 5f3da07..da11387 100644
--- a/services/core/java/com/android/server/power/ShutdownThread.java
+++ b/services/core/java/com/android/server/power/ShutdownThread.java
@@ -430,10 +430,10 @@
                 }
 
                 try {
-                    radioOff = phone == null || !phone.isRadioOn();
+                    radioOff = phone == null || !phone.needMobileRadioShutdown();
                     if (!radioOff) {
-                        Log.w(TAG, "Turning off radio...");
-                        phone.setRadio(false);
+                        Log.w(TAG, "Turning off cellular radios...");
+                        phone.shutdownMobileRadios();
                     }
                 } catch (RemoteException ex) {
                     Log.e(TAG, "RemoteException during radio shutdown", ex);
@@ -456,7 +456,7 @@
                     }
                     if (!radioOff) {
                         try {
-                            radioOff = !phone.isRadioOn();
+                            radioOff = !phone.needMobileRadioShutdown();
                         } catch (RemoteException ex) {
                             Log.e(TAG, "RemoteException during radio shutdown", ex);
                             radioOff = true;
@@ -472,7 +472,7 @@
                             Log.e(TAG, "RemoteException during NFC shutdown", ex);
                             nfcOff = true;
                         }
-                        if (radioOff) {
+                        if (nfcOff) {
                             Log.i(TAG, "NFC turned off.");
                         }
                     }
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 02aeacf..7baa258 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -4594,46 +4594,6 @@
     }
 
     @Override
-    public int setApplicationsHidden(ComponentName who, Intent intent, boolean hidden) {
-        int callingUserId = UserHandle.getCallingUserId();
-        synchronized (this) {
-            if (who == null) {
-                throw new NullPointerException("ComponentName is null");
-            }
-            getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
-
-            long id = Binder.clearCallingIdentity();
-            try {
-                IPackageManager pm = AppGlobals.getPackageManager();
-                List<ResolveInfo> activitiesToEnable = pm.queryIntentActivities(intent,
-                        intent.resolveTypeIfNeeded(mContext.getContentResolver()),
-                        PackageManager.GET_DISABLED_COMPONENTS
-                                | PackageManager.GET_UNINSTALLED_PACKAGES,
-                        callingUserId);
-
-                if (DBG) Slog.d(LOG_TAG, "Enabling activities: " + activitiesToEnable);
-                int numberOfAppsUnhidden = 0;
-                if (activitiesToEnable != null) {
-                    for (ResolveInfo info : activitiesToEnable) {
-                        if (info.activityInfo != null) {
-                            numberOfAppsUnhidden++;
-                            pm.setApplicationHiddenSettingAsUser(info.activityInfo.packageName,
-                                    hidden, callingUserId);
-                        }
-                    }
-                }
-                return numberOfAppsUnhidden;
-            } catch (RemoteException re) {
-                // shouldn't happen
-                Slog.e(LOG_TAG, "Failed to setApplicationsHiddenSettingsWithIntent", re);
-            } finally {
-                restoreCallingIdentity(id);
-            }
-            return 0;
-        }
-    }
-
-    @Override
     public boolean isApplicationHidden(ComponentName who, String packageName) {
         int callingUserId = UserHandle.getCallingUserId();
         synchronized (this) {
@@ -4809,7 +4769,8 @@
     }
 
     @Override
-    public void setBlockUninstall(ComponentName who, String packageName, boolean blockUninstall) {
+    public void setUninstallBlocked(ComponentName who, String packageName,
+            boolean uninstallBlocked) {
         final int userId = UserHandle.getCallingUserId();
 
         synchronized (this) {
@@ -4821,7 +4782,7 @@
             long id = Binder.clearCallingIdentity();
             try {
                 IPackageManager pm = AppGlobals.getPackageManager();
-                pm.setBlockUninstallForUser(packageName, blockUninstall, userId);
+                pm.setBlockUninstallForUser(packageName, uninstallBlocked, userId);
             } catch (RemoteException re) {
                 // Shouldn't happen.
                 Slog.e(LOG_TAG, "Failed to setBlockUninstallForUser", re);
@@ -4832,7 +4793,7 @@
     }
 
     @Override
-    public boolean getBlockUninstall(ComponentName who, String packageName) {
+    public boolean getUninstallBlocked(ComponentName who, String packageName) {
         final int userId = UserHandle.getCallingUserId();
 
         synchronized (this) {
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 22c09f0..b1c3c4a 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -793,5 +793,16 @@
      *         positive value success, data length of response
      */
     int invokeOemRilRequestRaw(in byte[] oemReq, out byte[] oemResp);
-}
 
+    /**
+     * Check if any mobile Radios need to be shutdown.
+     *
+     * @return true is any mobile radio needs to be shutdown
+     */
+    boolean needMobileRadioShutdown();
+
+    /**
+     * Shutdown Mobile Radios
+     */
+    void shutdownMobileRadios();
+}
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index a8a9057..e730bde 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -287,7 +287,10 @@
     int RIL_REQUEST_ALLOW_DATA = 123;
     int RIL_REQUEST_GET_HARDWARE_CONFIG = 124;
     int RIL_REQUEST_SIM_AUTHENTICATION = 125;
+    int RIL_REQUEST_GET_DC_RT_INFO = 126;
+    int RIL_REQUEST_SET_DC_RT_INFO_RATE = 127;
     int RIL_REQUEST_SET_DATA_PROFILE = 128;
+    int RIL_REQUEST_SHUTDOWN = 129;
 
     int RIL_UNSOL_RESPONSE_BASE = 1000;
     int RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000;
diff --git a/tests/ActivityTests/res/drawable-hdpi/icon.png b/tests/ActivityTests/res/drawable-hdpi/icon.png
new file mode 100644
index 0000000..2eab6f2
--- /dev/null
+++ b/tests/ActivityTests/res/drawable-hdpi/icon.png
Binary files differ
diff --git a/tests/ActivityTests/res/drawable-mdpi/icon.png b/tests/ActivityTests/res/drawable-mdpi/icon.png
new file mode 100644
index 0000000..63aec6f
--- /dev/null
+++ b/tests/ActivityTests/res/drawable-mdpi/icon.png
Binary files differ
diff --git a/tests/ActivityTests/res/drawable-xhdpi/icon.png b/tests/ActivityTests/res/drawable-xhdpi/icon.png
new file mode 100644
index 0000000..8ea9c48
--- /dev/null
+++ b/tests/ActivityTests/res/drawable-xhdpi/icon.png
Binary files differ
diff --git a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
index 9002125..7f3aa77 100644
--- a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
+++ b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
@@ -28,6 +28,7 @@
 import android.content.ContentProviderClient;
 import android.content.Intent;
 import android.content.ServiceConnection;
+import android.graphics.BitmapFactory;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.os.RemoteException;
@@ -219,7 +220,7 @@
             @Override public boolean onMenuItemClick(MenuItem item) {
                 Intent intent = new Intent(ActivityTestMain.this, UserTarget.class);
                 sendOrderedBroadcastAsUser(intent, new UserHandle(mSecondUser), null,
-                        new BroadcastResultReceiver(), 
+                        new BroadcastResultReceiver(),
                         null, Activity.RESULT_OK, null, null);
                 return true;
             }
@@ -291,6 +292,30 @@
                 return true;
             }
         });
+        menu.add("Add App Recent").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+            @Override public boolean onMenuItemClick(MenuItem item) {
+                addAppRecents(1);
+                return true;
+            }
+        });
+        menu.add("Add App 10x Recent").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+            @Override public boolean onMenuItemClick(MenuItem item) {
+                addAppRecents(10);
+                return true;
+            }
+        });
+        menu.add("Exclude!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+            @Override public boolean onMenuItemClick(MenuItem item) {
+                setExclude(true);
+                return true;
+            }
+        });
+        menu.add("Include!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+            @Override public boolean onMenuItemClick(MenuItem item) {
+                setExclude(false);
+                return true;
+            }
+        });
         return true;
     }
 
@@ -317,7 +342,36 @@
         mConnections.clear();
     }
 
-    private View scrollWrap(View view) {
+    void addAppRecents(int count) {
+        ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
+        Intent intent = new Intent(Intent.ACTION_MAIN);
+        intent.addCategory(Intent.CATEGORY_LAUNCHER);
+        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
+        intent.setComponent(new ComponentName(this, ActivityTestMain.class));
+        for (int i=0; i<count; i++) {
+            ActivityManager.TaskDescription desc = new ActivityManager.TaskDescription();
+            desc.setLabel("Added #" + i);
+            Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
+            if ((i&1) == 0) {
+                desc.setIcon(bitmap);
+            }
+            int taskId = am.addAppTask(this, intent, desc, bitmap);
+            Log.i(TAG, "Added new task id #" + taskId);
+        }
+    }
+
+    void setExclude(boolean exclude) {
+        ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
+        List<ActivityManager.AppTask> tasks = am.getAppTasks();
+        int taskId = getTaskId();
+        for (int i=0; i<tasks.size(); i++) {
+            ActivityManager.AppTask task = tasks.get(i);
+            if (task.getTaskInfo().id == taskId) {
+                task.setExcludeFromRecents(exclude);
+            }
+        }
+    }
+     private View scrollWrap(View view) {
         ScrollView scroller = new ScrollView(this);
         scroller.addView(view, new ScrollView.LayoutParams(ScrollView.LayoutParams.MATCH_PARENT,
                 ScrollView.LayoutParams.MATCH_PARENT));
diff --git a/wifi/java/android/net/wifi/ScanResult.java b/wifi/java/android/net/wifi/ScanResult.java
index a01a6b6..f2db206 100644
--- a/wifi/java/android/net/wifi/ScanResult.java
+++ b/wifi/java/android/net/wifi/ScanResult.java
@@ -106,7 +106,24 @@
      * Status: indicating join status
      * @hide
      */
-    public int status;
+    public int autoJoinStatus;
+
+    /**
+     * @hide
+     * Last time we blacklisted the ScanResult
+     */
+    public long blackListTimestamp;
+
+    /** @hide **/
+    public void setAutoJoinStatus(int status) {
+        if (status < 0) status = 0;
+        if (status == 0) {
+            blackListTimestamp = 0;
+        }  else if (status > autoJoinStatus) {
+            blackListTimestamp = System.currentTimeMillis();
+        }
+        autoJoinStatus = status;
+    }
 
     /**
      * Status: indicating the scan result is not a result
@@ -244,7 +261,7 @@
             distanceSdCm = source.distanceSdCm;
             seen = source.seen;
             passpoint = source.passpoint;
-            status = source.status;
+            autoJoinStatus = source.autoJoinStatus;
             untrusted = source.untrusted;
             numConnection = source.numConnection;
             numUsage = source.numUsage;
@@ -282,8 +299,8 @@
                 append("(cm)");
 
         sb.append(", passpoint: ").append(passpoint != null ? "yes" : "no");
-        if (status != 0) {
-            sb.append(", status: ").append(status);
+        if (autoJoinStatus != 0) {
+            sb.append(", status: ").append(autoJoinStatus);
         }
         return sb.toString();
     }
@@ -309,7 +326,7 @@
         dest.writeInt(distanceCm);
         dest.writeInt(distanceSdCm);
         dest.writeLong(seen);
-        dest.writeInt(status);
+        dest.writeInt(autoJoinStatus);
         dest.writeInt(untrusted ? 1 : 0);
         dest.writeInt(numConnection);
         dest.writeInt(numUsage);
@@ -350,7 +367,7 @@
                     in.readInt()
                 );
                 sr.seen = in.readLong();
-                sr.status = in.readInt();
+                sr.autoJoinStatus = in.readInt();
                 sr.untrusted = in.readInt() != 0;
                 sr.numConnection = in.readInt();
                 sr.numUsage = in.readInt();
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 3d976e7..e27bd7e 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -1696,7 +1696,6 @@
      *
      * @hide
      */
-    @SystemApi
     public void connect(WifiConfiguration config, ActionListener listener) {
         if (config == null) throw new IllegalArgumentException("config cannot be null");
         validateChannel();
@@ -1719,7 +1718,6 @@
      * initialized again
      * @hide
      */
-    @SystemApi
     public void connect(int networkId, ActionListener listener) {
         if (networkId < 0) throw new IllegalArgumentException("Network id cannot be negative");
         validateChannel();
@@ -1744,7 +1742,6 @@
      * initialized again
      * @hide
      */
-    @SystemApi
     public void save(WifiConfiguration config, ActionListener listener) {
         if (config == null) throw new IllegalArgumentException("config cannot be null");
         validateChannel();
@@ -1764,7 +1761,6 @@
      * initialized again
      * @hide
      */
-    @SystemApi
     public void forget(int netId, ActionListener listener) {
         if (netId < 0) throw new IllegalArgumentException("Network id cannot be negative");
         validateChannel();
@@ -1780,7 +1776,6 @@
      * initialized again
      * @hide
      */
-    @SystemApi
     public void disable(int netId, ActionListener listener) {
         if (netId < 0) throw new IllegalArgumentException("Network id cannot be negative");
         validateChannel();