Merge "Import translations. DO NOT MERGE" into oc-dev
diff --git a/api/current.txt b/api/current.txt
index eec812c..a7c6737 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -1061,6 +1061,7 @@
     field public static final int ratingBarStyleSmall = 16842877; // 0x101007d
     field public static final int readPermission = 16842759; // 0x1010007
     field public static final int recognitionService = 16843932; // 0x101049c
+    field public static final int recreateOnConfigChanges = 16844105; // 0x1010549
     field public static final int recycleEnabled = 16844124; // 0x101055c
     field public static final int relinquishTaskIdentity = 16843894; // 0x1010476
     field public static final int reparent = 16843964; // 0x10104bc
@@ -1085,7 +1086,6 @@
     field public static final int resizeable = 16843405; // 0x101028d
     field public static final int resizeableActivity = 16844022; // 0x10104f6
     field public static final int resource = 16842789; // 0x1010025
-    field public static final int restartOnConfigChanges = 16844105; // 0x1010549
     field public static final int restoreAnyVersion = 16843450; // 0x10102ba
     field public static final deprecated int restoreNeedsApplication = 16843421; // 0x101029d
     field public static final int restrictedAccountType = 16843733; // 0x10103d5
@@ -1708,7 +1708,6 @@
     field public static final int ic_notification_clear_all = 17301594; // 0x108005a
     field public static final int ic_notification_overlay = 17301595; // 0x108005b
     field public static final int ic_partial_secure = 17301596; // 0x108005c
-    field public static final int ic_picture_in_picture = 17301685; // 0x10800b5
     field public static final int ic_popup_disk_full = 17301597; // 0x108005d
     field public static final int ic_popup_reminder = 17301598; // 0x108005e
     field public static final int ic_popup_sync = 17301599; // 0x108005f
@@ -2829,7 +2828,7 @@
     method public android.content.pm.ResolveInfo getResolveInfo();
     method public java.lang.String getSettingsActivityName();
     method public java.lang.String loadDescription(android.content.pm.PackageManager);
-    method public java.lang.String loadSummary(android.content.pm.PackageManager);
+    method public java.lang.CharSequence loadSummary(android.content.pm.PackageManager);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int CAPABILITY_CAN_CONTROL_MAGNIFICATION = 16; // 0x10
     field public static final int CAPABILITY_CAN_PERFORM_GESTURES = 32; // 0x20
@@ -3580,7 +3579,6 @@
     method public boolean dispatchTrackballEvent(android.view.MotionEvent);
     method public void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
     method public deprecated void enterPictureInPictureMode();
-    method public deprecated boolean enterPictureInPictureMode(android.app.PictureInPictureArgs);
     method public boolean enterPictureInPictureMode(android.app.PictureInPictureParams);
     method public <T extends android.view.View> T findViewById(int);
     method public void finish();
@@ -3755,7 +3753,6 @@
     method public void setImmersive(boolean);
     method public void setIntent(android.content.Intent);
     method public final void setMediaController(android.media.session.MediaController);
-    method public void setPictureInPictureArgs(android.app.PictureInPictureArgs);
     method public void setPictureInPictureParams(android.app.PictureInPictureParams);
     method public final deprecated void setProgress(int);
     method public final deprecated void setProgressBarIndeterminate(boolean);
@@ -3835,7 +3832,6 @@
     method public int getLauncherLargeIconDensity();
     method public int getLauncherLargeIconSize();
     method public int getLockTaskModeState();
-    method public static deprecated int getMaxNumPictureInPictureActions();
     method public int getMemoryClass();
     method public void getMemoryInfo(android.app.ActivityManager.MemoryInfo);
     method public static void getMyMemoryState(android.app.ActivityManager.RunningAppProcessInfo);
@@ -4699,7 +4695,6 @@
 
   public abstract class FragmentContainer {
     ctor public FragmentContainer();
-    method public android.app.Fragment instantiate(android.content.Context, java.lang.String, android.os.Bundle);
     method public abstract <T extends android.view.View> T onFindViewById(int);
     method public abstract boolean onHasView();
   }
@@ -4972,7 +4967,6 @@
 
   public class KeyguardManager {
     method public android.content.Intent createConfirmDeviceCredentialIntent(java.lang.CharSequence, java.lang.CharSequence);
-    method public deprecated void dismissKeyguard(android.app.Activity, android.app.KeyguardManager.KeyguardDismissCallback, android.os.Handler);
     method public deprecated void exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult);
     method public boolean inKeyguardRestrictedInputMode();
     method public boolean isDeviceLocked();
@@ -5121,7 +5115,6 @@
     method public android.app.Notification clone();
     method public int describeContents();
     method public int getBadgeIconType();
-    method public java.lang.String getChannel();
     method public java.lang.String getChannelId();
     method public java.lang.String getGroup();
     method public int getGroupAlertBehavior();
@@ -5130,7 +5123,6 @@
     method public java.lang.String getShortcutId();
     method public android.graphics.drawable.Icon getSmallIcon();
     method public java.lang.String getSortKey();
-    method public long getTimeout();
     method public long getTimeoutAfter();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.media.AudioAttributes AUDIO_ATTRIBUTES_DEFAULT;
@@ -5333,7 +5325,6 @@
     method public android.app.Notification.Builder setAutoCancel(boolean);
     method public android.app.Notification.Builder setBadgeIconType(int);
     method public android.app.Notification.Builder setCategory(java.lang.String);
-    method public android.app.Notification.Builder setChannel(java.lang.String);
     method public android.app.Notification.Builder setChannelId(java.lang.String);
     method public android.app.Notification.Builder setChronometerCountDown(boolean);
     method public android.app.Notification.Builder setColor(int);
@@ -5378,7 +5369,6 @@
     method public android.app.Notification.Builder setSubText(java.lang.CharSequence);
     method public android.app.Notification.Builder setTicker(java.lang.CharSequence);
     method public deprecated android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
-    method public android.app.Notification.Builder setTimeout(long);
     method public android.app.Notification.Builder setTimeoutAfter(long);
     method public android.app.Notification.Builder setUsesChronometer(boolean);
     method public deprecated android.app.Notification.Builder setVibrate(long[]);
@@ -5697,21 +5687,10 @@
     method public abstract void onSendFinished(android.app.PendingIntent, android.content.Intent, int, java.lang.String, android.os.Bundle);
   }
 
-  public final deprecated class PictureInPictureArgs extends android.app.PictureInPictureParams {
-    ctor public deprecated PictureInPictureArgs();
-    ctor public deprecated PictureInPictureArgs(float, java.util.List<android.app.RemoteAction>);
-    method public deprecated void setActions(java.util.List<android.app.RemoteAction>);
-    method public deprecated void setAspectRatio(float);
-    method public deprecated void setSourceRectHint(android.graphics.Rect);
-  }
-
-  public class PictureInPictureParams implements android.os.Parcelable {
+  public final class PictureInPictureParams implements android.os.Parcelable {
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.app.PictureInPictureParams> CREATOR;
-    field protected android.util.Rational mAspectRatio;
-    field protected android.graphics.Rect mSourceRectHint;
-    field protected java.util.List<android.app.RemoteAction> mUserActions;
   }
 
   public static class PictureInPictureParams.Builder {
@@ -9329,15 +9308,12 @@
     field public static final java.lang.String ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON";
     field public static final java.lang.String ACTION_CARRIER_SETUP = "android.intent.action.CARRIER_SETUP";
     field public static final java.lang.String ACTION_CHOOSER = "android.intent.action.CHOOSER";
-    field public static final java.lang.String ACTION_CLEAR_PACKAGE = "android.intent.action.CLEAR_PACKAGE";
     field public static final java.lang.String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS";
     field public static final java.lang.String ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED";
     field public static final java.lang.String ACTION_CREATE_DOCUMENT = "android.intent.action.CREATE_DOCUMENT";
     field public static final java.lang.String ACTION_CREATE_SHORTCUT = "android.intent.action.CREATE_SHORTCUT";
     field public static final java.lang.String ACTION_DATE_CHANGED = "android.intent.action.DATE_CHANGED";
     field public static final java.lang.String ACTION_DEFAULT = "android.intent.action.VIEW";
-    field public static final java.lang.String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED = "android.intent.action.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED";
-    field public static final java.lang.String ACTION_DEFAULT_SUBSCRIPTION_CHANGED = "android.intent.action.ACTION_DEFAULT_SUBSCRIPTION_CHANGED";
     field public static final java.lang.String ACTION_DELETE = "android.intent.action.DELETE";
     field public static final deprecated java.lang.String ACTION_DEVICE_STORAGE_LOW = "android.intent.action.DEVICE_STORAGE_LOW";
     field public static final deprecated java.lang.String ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK";
@@ -9541,7 +9517,6 @@
     field public static final java.lang.String EXTRA_SHUTDOWN_USERSPACE_ONLY = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY";
     field public static final java.lang.String EXTRA_STREAM = "android.intent.extra.STREAM";
     field public static final java.lang.String EXTRA_SUBJECT = "android.intent.extra.SUBJECT";
-    field public static final java.lang.String EXTRA_SUBSCRIPTION_INDEX = "android.intent.extra.SUBSCRIPTION_INDEX";
     field public static final java.lang.String EXTRA_TEMPLATE = "android.intent.extra.TEMPLATE";
     field public static final java.lang.String EXTRA_TEXT = "android.intent.extra.TEXT";
     field public static final java.lang.String EXTRA_TITLE = "android.intent.extra.TITLE";
@@ -10913,8 +10888,8 @@
     field public android.content.pm.ActivityInfo activityInfo;
     field public android.content.IntentFilter filter;
     field public int icon;
-    field public boolean instantAppAvailable;
     field public boolean isDefault;
+    field public boolean isInstantAppAvailable;
     field public int labelRes;
     field public int match;
     field public java.lang.CharSequence nonLocalizedLabel;
@@ -10951,7 +10926,7 @@
     method public java.util.List<android.content.pm.VersionedPackage> getDependentPackages();
     method public java.lang.String getName();
     method public int getType();
-    method public long getVersion();
+    method public int getVersion();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.content.pm.SharedLibraryInfo> CREATOR;
     field public static final int TYPE_BUILTIN = 0; // 0x0
@@ -13838,6 +13813,7 @@
 package android.graphics.drawable {
 
   public class AdaptiveIconDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+    ctor public AdaptiveIconDrawable(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
     method public void draw(android.graphics.Canvas);
     method public android.graphics.drawable.Drawable getBackground();
     method public static float getExtraInsetFraction();
@@ -26549,6 +26525,7 @@
     method public void setTdlsEnabled(java.net.InetAddress, boolean);
     method public void setTdlsEnabledWithMacAddress(java.lang.String, boolean);
     method public boolean setWifiEnabled(boolean);
+    method public void startLocalOnlyHotspot(android.net.wifi.WifiManager.LocalOnlyHotspotCallback, android.os.Handler);
     method public boolean startScan();
     method public void startWps(android.net.wifi.WpsInfo, android.net.wifi.WifiManager.WpsCallback);
     method public int updateNetwork(android.net.wifi.WifiConfiguration);
@@ -26599,6 +26576,22 @@
     field public static final int WPS_WEP_PROHIBITED = 4; // 0x4
   }
 
+  public static class WifiManager.LocalOnlyHotspotCallback {
+    ctor public WifiManager.LocalOnlyHotspotCallback();
+    method public void onFailed(int);
+    method public void onStarted(android.net.wifi.WifiManager.LocalOnlyHotspotReservation);
+    method public void onStopped();
+    field public static final int ERROR_GENERIC = 2; // 0x2
+    field public static final int ERROR_INCOMPATIBLE_MODE = 3; // 0x3
+    field public static final int ERROR_NO_CHANNEL = 1; // 0x1
+    field public static final int ERROR_TETHERING_DISALLOWED = 4; // 0x4
+  }
+
+  public class WifiManager.LocalOnlyHotspotReservation implements java.lang.AutoCloseable {
+    method public void close();
+    method public android.net.wifi.WifiConfiguration getWifiConfiguration();
+  }
+
   public class WifiManager.MulticastLock {
     method public void acquire();
     method public boolean isHeld();
@@ -26764,28 +26757,28 @@
     method public int getCredentialPriority();
     method public android.net.wifi.hotspot2.pps.HomeSp getHomeSp();
     method public android.net.wifi.hotspot2.pps.Policy getPolicy();
-    method public long getSubscriptionCreationTimeInMs();
-    method public long getSubscriptionExpirationTimeInMs();
+    method public long getSubscriptionCreationTimeInMillis();
+    method public long getSubscriptionExpirationTimeInMillis();
     method public java.lang.String getSubscriptionType();
     method public android.net.wifi.hotspot2.pps.UpdateParameter getSubscriptionUpdate();
     method public java.util.Map<java.lang.String, byte[]> getTrustRootCertList();
     method public int getUpdateIdentifier();
     method public long getUsageLimitDataLimit();
-    method public long getUsageLimitStartTimeInMs();
+    method public long getUsageLimitStartTimeInMillis();
     method public long getUsageLimitTimeLimitInMinutes();
     method public long getUsageLimitUsageTimePeriodInMinutes();
     method public void setCredential(android.net.wifi.hotspot2.pps.Credential);
     method public void setCredentialPriority(int);
     method public void setHomeSp(android.net.wifi.hotspot2.pps.HomeSp);
     method public void setPolicy(android.net.wifi.hotspot2.pps.Policy);
-    method public void setSubscriptionCreationTimeInMs(long);
-    method public void setSubscriptionExpirationTimeInMs(long);
+    method public void setSubscriptionCreationTimeInMillis(long);
+    method public void setSubscriptionExpirationTimeInMillis(long);
     method public void setSubscriptionType(java.lang.String);
     method public void setSubscriptionUpdate(android.net.wifi.hotspot2.pps.UpdateParameter);
     method public void setTrustRootCertList(java.util.Map<java.lang.String, byte[]>);
     method public void setUpdateIdentifier(int);
     method public void setUsageLimitDataLimit(long);
-    method public void setUsageLimitStartTimeInMs(long);
+    method public void setUsageLimitStartTimeInMillis(long);
     method public void setUsageLimitTimeLimitInMinutes(long);
     method public void setUsageLimitUsageTimePeriodInMinutes(long);
     method public void writeToParcel(android.os.Parcel, int);
@@ -26813,8 +26806,8 @@
     method public boolean getCheckAaaServerCertStatus();
     method public java.security.cert.X509Certificate[] getClientCertificateChain();
     method public java.security.PrivateKey getClientPrivateKey();
-    method public long getCreationTimeInMs();
-    method public long getExpirationTimeInMs();
+    method public long getCreationTimeInMillis();
+    method public long getExpirationTimeInMillis();
     method public java.lang.String getRealm();
     method public android.net.wifi.hotspot2.pps.Credential.SimCredential getSimCredential();
     method public android.net.wifi.hotspot2.pps.Credential.UserCredential getUserCredential();
@@ -26823,8 +26816,8 @@
     method public void setCheckAaaServerCertStatus(boolean);
     method public void setClientCertificateChain(java.security.cert.X509Certificate[]);
     method public void setClientPrivateKey(java.security.PrivateKey);
-    method public void setCreationTimeInMs(long);
-    method public void setExpirationTimeInMs(long);
+    method public void setCreationTimeInMillis(long);
+    method public void setExpirationTimeInMillis(long);
     method public void setRealm(java.lang.String);
     method public void setSimCredential(android.net.wifi.hotspot2.pps.Credential.SimCredential);
     method public void setUserCredential(android.net.wifi.hotspot2.pps.Credential.UserCredential);
@@ -31601,7 +31594,7 @@
 
   public class TestLooperManager {
     method public void execute(android.os.Message);
-    method public android.os.MessageQueue getQueue();
+    method public android.os.MessageQueue getMessageQueue();
     method public boolean hasMessages(android.os.Handler, java.lang.Object, int);
     method public boolean hasMessages(android.os.Handler, java.lang.Object, java.lang.Runnable);
     method public android.os.Message next();
@@ -37012,7 +37005,7 @@
   public final class FillRequest implements android.os.Parcelable {
     method public int describeContents();
     method public android.os.Bundle getClientState();
-    method public java.util.ArrayList<android.service.autofill.FillContext> getFillContexts();
+    method public java.util.List<android.service.autofill.FillContext> getFillContexts();
     method public int getFlags();
     method public int getId();
     method public void writeToParcel(android.os.Parcel, int);
@@ -37994,7 +37987,6 @@
     method public void onRangeStart(java.lang.String, int, int, int);
     method public abstract void onStart(java.lang.String);
     method public void onStop(java.lang.String, boolean);
-    method public deprecated void onUtteranceRangeStart(java.lang.String, int, int);
   }
 
   public class Voice implements android.os.Parcelable {
@@ -40075,8 +40067,11 @@
     method public static int getDefaultVoiceSubscriptionId();
     method public boolean isNetworkRoaming(int);
     method public void removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
+    field public static final java.lang.String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED = "android.telephony.action.DEFAULT_SMS_SUBSCRIPTION_CHANGED";
+    field public static final java.lang.String ACTION_DEFAULT_SUBSCRIPTION_CHANGED = "android.telephony.action.DEFAULT_SUBSCRIPTION_CHANGED";
     field public static final int DATA_ROAMING_DISABLE = 0; // 0x0
     field public static final int DATA_ROAMING_ENABLE = 1; // 0x1
+    field public static final java.lang.String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX";
     field public static final int INVALID_SUBSCRIPTION_ID = -1; // 0xffffffff
   }
 
@@ -47768,7 +47763,7 @@
     method public void unregisterCallback(android.view.autofill.AutofillManager.AutofillCallback);
     field public static final java.lang.String EXTRA_ASSIST_STRUCTURE = "android.view.autofill.extra.ASSIST_STRUCTURE";
     field public static final java.lang.String EXTRA_AUTHENTICATION_RESULT = "android.view.autofill.extra.AUTHENTICATION_RESULT";
-    field public static final java.lang.String EXTRA_CLIENT_STATE = "android.view.autofill.extra.EXTRA_CLIENT_STATE";
+    field public static final java.lang.String EXTRA_CLIENT_STATE = "android.view.autofill.extra.CLIENT_STATE";
   }
 
   public static abstract class AutofillManager.AutofillCallback {
diff --git a/api/removed.txt b/api/removed.txt
index 779ff7c..1873499 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -1,9 +1,59 @@
 package android.app {
 
+  public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
+    method public deprecated boolean enterPictureInPictureMode(android.app.PictureInPictureArgs);
+    method public deprecated void setPictureInPictureArgs(android.app.PictureInPictureArgs);
+  }
+
+  public class ActivityManager {
+    method public static deprecated int getMaxNumPictureInPictureActions();
+  }
+
+  public class KeyguardManager {
+    method public deprecated void dismissKeyguard(android.app.Activity, android.app.KeyguardManager.KeyguardDismissCallback, android.os.Handler);
+  }
+
   public class Notification implements android.os.Parcelable {
+    method public deprecated java.lang.String getChannel();
+    method public deprecated long getTimeout();
     method public deprecated void setLatestEventInfo(android.content.Context, java.lang.CharSequence, java.lang.CharSequence, android.app.PendingIntent);
   }
 
+  public static class Notification.Builder {
+    method public deprecated android.app.Notification.Builder setChannel(java.lang.String);
+    method public deprecated android.app.Notification.Builder setTimeout(long);
+  }
+
+  public static final class Notification.TvExtender implements android.app.Notification.Extender {
+    method public deprecated java.lang.String getChannel();
+  }
+
+  public final deprecated class PictureInPictureArgs implements android.os.Parcelable {
+    method public static android.app.PictureInPictureArgs convert(android.app.PictureInPictureParams);
+    method public static android.app.PictureInPictureParams convert(android.app.PictureInPictureArgs);
+    method public void copyOnlySet(android.app.PictureInPictureArgs);
+    method public java.util.List<android.app.RemoteAction> getActions();
+    method public float getAspectRatio();
+    method public android.util.Rational getAspectRatioRational();
+    method public android.graphics.Rect getSourceRectHint();
+    method public android.graphics.Rect getSourceRectHintInsets();
+    method public boolean hasSetActions();
+    method public boolean hasSetAspectRatio();
+    method public boolean hasSourceBoundsHint();
+    method public boolean hasSourceBoundsHintInsets();
+    method public deprecated void setSourceRectHintInsets(android.graphics.Rect);
+    method public void truncateActions(int);
+    field public static final android.os.Parcelable.Creator<android.app.PictureInPictureArgs> CREATOR;
+  }
+
+  public static class PictureInPictureArgs.Builder {
+    ctor public PictureInPictureArgs.Builder();
+    method public android.app.PictureInPictureArgs build();
+    method public android.app.PictureInPictureArgs.Builder setActions(java.util.List<android.app.RemoteAction>);
+    method public android.app.PictureInPictureArgs.Builder setAspectRatio(android.util.Rational);
+    method public android.app.PictureInPictureArgs.Builder setSourceRectHint(android.graphics.Rect);
+  }
+
   public final class RecoverableSecurityException extends java.lang.SecurityException implements android.os.Parcelable {
     method public deprecated void showAsNotification(android.content.Context);
   }
@@ -76,6 +126,10 @@
     method public abstract boolean setInstantAppCookie(byte[]);
   }
 
+  public class ResolveInfo implements android.os.Parcelable {
+    field public deprecated boolean instantAppAvailable;
+  }
+
   public final class SharedLibraryInfo implements android.os.Parcelable {
     method public boolean isBuiltin();
     method public boolean isDynamic();
@@ -188,6 +242,26 @@
     method public deprecated int stopUsingNetworkFeature(int, java.lang.String);
   }
 
+  public deprecated class NetworkBadging {
+    method public static android.graphics.drawable.Drawable getWifiIcon(int, int, android.content.res.Resources.Theme);
+    field public static final int BADGING_4K = 30; // 0x1e
+    field public static final int BADGING_HD = 20; // 0x14
+    field public static final int BADGING_NONE = 0; // 0x0
+    field public static final int BADGING_SD = 10; // 0xa
+  }
+
+  public abstract class NetworkRecommendationProvider {
+    ctor public deprecated NetworkRecommendationProvider(android.os.Handler);
+    method public deprecated void onRequestRecommendation(android.net.RecommendationRequest, android.net.NetworkRecommendationProvider.ResultCallback);
+    field public static final deprecated java.lang.String EXTRA_RECOMMENDATION_RESULT = "android.net.extra.RECOMMENDATION_RESULT";
+    field public static final deprecated java.lang.String EXTRA_SEQUENCE = "android.net.extra.SEQUENCE";
+  }
+
+  public static deprecated class NetworkRecommendationProvider.ResultCallback {
+    ctor public NetworkRecommendationProvider.ResultCallback(android.os.IRemoteCallback, int);
+    method public void onResult(android.net.RecommendationResult);
+  }
+
   public abstract class PskKeyManager {
     ctor public PskKeyManager();
     field public static final int MAX_IDENTITY_HINT_LENGTH_BYTES = 128; // 0x80
@@ -195,6 +269,37 @@
     field public static final int MAX_KEY_LENGTH_BYTES = 256; // 0x100
   }
 
+  public final deprecated class RecommendationRequest implements android.os.Parcelable {
+    ctor protected RecommendationRequest(android.os.Parcel);
+    method public android.net.wifi.WifiConfiguration[] getConnectableConfigs();
+    method public android.net.wifi.WifiConfiguration getConnectedConfig();
+    method public android.net.wifi.WifiConfiguration getDefaultWifiConfig();
+    method public int getLastSelectedNetworkId();
+    method public long getLastSelectedNetworkTimestamp();
+    method public android.net.wifi.ScanResult[] getScanResults();
+    method public void setConnectableConfigs(android.net.wifi.WifiConfiguration[]);
+    method public void setConnectedConfig(android.net.wifi.WifiConfiguration);
+    field public static final android.os.Parcelable.Creator<android.net.RecommendationRequest> CREATOR;
+  }
+
+  public static final deprecated class RecommendationRequest.Builder {
+    ctor public RecommendationRequest.Builder();
+    method public android.net.RecommendationRequest build();
+    method public android.net.RecommendationRequest.Builder setConnectableConfigs(android.net.wifi.WifiConfiguration[]);
+    method public android.net.RecommendationRequest.Builder setConnectedWifiConfig(android.net.wifi.WifiConfiguration);
+    method public android.net.RecommendationRequest.Builder setDefaultWifiConfig(android.net.wifi.WifiConfiguration);
+    method public android.net.RecommendationRequest.Builder setLastSelectedNetwork(int, long);
+    method public android.net.RecommendationRequest.Builder setScanResults(android.net.wifi.ScanResult[]);
+  }
+
+  public final deprecated class RecommendationResult implements android.os.Parcelable {
+    method public static android.net.RecommendationResult createConnectRecommendation(android.net.wifi.WifiConfiguration);
+    method public static android.net.RecommendationResult createDoNotConnectRecommendation();
+    method public android.net.wifi.WifiConfiguration getWifiConfiguration();
+    method public boolean hasRecommendation();
+    field public static final android.os.Parcelable.Creator<android.net.RecommendationResult> CREATOR;
+  }
+
   public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {
     method public static deprecated org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int, android.net.SSLSessionCache);
   }
@@ -221,6 +326,10 @@
     ctor public RecoverySystem();
   }
 
+  public class TestLooperManager {
+    method public deprecated android.os.MessageQueue getQueue();
+  }
+
   public class UserManager {
     method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle, android.graphics.Rect, int);
     method public android.graphics.drawable.Drawable getBadgedIconForUser(android.graphics.drawable.Drawable, android.os.UserHandle);
@@ -382,6 +491,14 @@
 
 }
 
+package android.speech.tts {
+
+  public abstract class UtteranceProgressListener {
+    method public deprecated void onUtteranceRangeStart(java.lang.String, int, int);
+  }
+
+}
+
 package android.test.mock {
 
   public deprecated class MockPackageManager extends android.content.pm.PackageManager {
diff --git a/api/system-current.txt b/api/system-current.txt
index aff5b1d..0eb5d4e 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1182,6 +1182,7 @@
     field public static final int ratingBarStyleSmall = 16842877; // 0x101007d
     field public static final int readPermission = 16842759; // 0x1010007
     field public static final int recognitionService = 16843932; // 0x101049c
+    field public static final int recreateOnConfigChanges = 16844105; // 0x1010549
     field public static final int recycleEnabled = 16844124; // 0x101055c
     field public static final int relinquishTaskIdentity = 16843894; // 0x1010476
     field public static final int reparent = 16843964; // 0x10104bc
@@ -1208,7 +1209,6 @@
     field public static final int resizeable = 16843405; // 0x101028d
     field public static final int resizeableActivity = 16844022; // 0x10104f6
     field public static final int resource = 16842789; // 0x1010025
-    field public static final int restartOnConfigChanges = 16844105; // 0x1010549
     field public static final int restoreAnyVersion = 16843450; // 0x10102ba
     field public static final deprecated int restoreNeedsApplication = 16843421; // 0x101029d
     field public static final int restrictedAccountType = 16843733; // 0x10103d5
@@ -1835,7 +1835,6 @@
     field public static final int ic_notification_clear_all = 17301594; // 0x108005a
     field public static final int ic_notification_overlay = 17301595; // 0x108005b
     field public static final int ic_partial_secure = 17301596; // 0x108005c
-    field public static final int ic_picture_in_picture = 17301685; // 0x10800b5
     field public static final int ic_popup_disk_full = 17301597; // 0x108005d
     field public static final int ic_popup_reminder = 17301598; // 0x108005e
     field public static final int ic_popup_sync = 17301599; // 0x108005f
@@ -2959,7 +2958,7 @@
     method public android.content.pm.ResolveInfo getResolveInfo();
     method public java.lang.String getSettingsActivityName();
     method public java.lang.String loadDescription(android.content.pm.PackageManager);
-    method public java.lang.String loadSummary(android.content.pm.PackageManager);
+    method public java.lang.CharSequence loadSummary(android.content.pm.PackageManager);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int CAPABILITY_CAN_CONTROL_MAGNIFICATION = 16; // 0x10
     field public static final int CAPABILITY_CAN_PERFORM_GESTURES = 32; // 0x20
@@ -3713,7 +3712,6 @@
     method public boolean dispatchTrackballEvent(android.view.MotionEvent);
     method public void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
     method public deprecated void enterPictureInPictureMode();
-    method public deprecated boolean enterPictureInPictureMode(android.app.PictureInPictureArgs);
     method public boolean enterPictureInPictureMode(android.app.PictureInPictureParams);
     method public <T extends android.view.View> T findViewById(int);
     method public void finish();
@@ -3891,7 +3889,6 @@
     method public void setImmersive(boolean);
     method public void setIntent(android.content.Intent);
     method public final void setMediaController(android.media.session.MediaController);
-    method public void setPictureInPictureArgs(android.app.PictureInPictureArgs);
     method public void setPictureInPictureParams(android.app.PictureInPictureParams);
     method public final deprecated void setProgress(int);
     method public final deprecated void setProgressBarIndeterminate(boolean);
@@ -3978,7 +3975,6 @@
     method public int getLauncherLargeIconDensity();
     method public int getLauncherLargeIconSize();
     method public int getLockTaskModeState();
-    method public static deprecated int getMaxNumPictureInPictureActions();
     method public int getMemoryClass();
     method public void getMemoryInfo(android.app.ActivityManager.MemoryInfo);
     method public static void getMyMemoryState(android.app.ActivityManager.RunningAppProcessInfo);
@@ -4869,7 +4865,6 @@
 
   public abstract class FragmentContainer {
     ctor public FragmentContainer();
-    method public android.app.Fragment instantiate(android.content.Context, java.lang.String, android.os.Bundle);
     method public abstract <T extends android.view.View> T onFindViewById(int);
     method public abstract boolean onHasView();
   }
@@ -5154,7 +5149,6 @@
 
   public class KeyguardManager {
     method public android.content.Intent createConfirmDeviceCredentialIntent(java.lang.CharSequence, java.lang.CharSequence);
-    method public deprecated void dismissKeyguard(android.app.Activity, android.app.KeyguardManager.KeyguardDismissCallback, android.os.Handler);
     method public deprecated void exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult);
     method public boolean inKeyguardRestrictedInputMode();
     method public boolean isDeviceLocked();
@@ -5303,7 +5297,6 @@
     method public android.app.Notification clone();
     method public int describeContents();
     method public int getBadgeIconType();
-    method public java.lang.String getChannel();
     method public java.lang.String getChannelId();
     method public java.lang.String getGroup();
     method public int getGroupAlertBehavior();
@@ -5313,7 +5306,6 @@
     method public java.lang.String getShortcutId();
     method public android.graphics.drawable.Icon getSmallIcon();
     method public java.lang.String getSortKey();
-    method public long getTimeout();
     method public long getTimeoutAfter();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.media.AudioAttributes AUDIO_ATTRIBUTES_DEFAULT;
@@ -5519,7 +5511,6 @@
     method public android.app.Notification.Builder setAutoCancel(boolean);
     method public android.app.Notification.Builder setBadgeIconType(int);
     method public android.app.Notification.Builder setCategory(java.lang.String);
-    method public android.app.Notification.Builder setChannel(java.lang.String);
     method public android.app.Notification.Builder setChannelId(java.lang.String);
     method public android.app.Notification.Builder setChronometerCountDown(boolean);
     method public android.app.Notification.Builder setColor(int);
@@ -5564,7 +5555,6 @@
     method public android.app.Notification.Builder setSubText(java.lang.CharSequence);
     method public android.app.Notification.Builder setTicker(java.lang.CharSequence);
     method public deprecated android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
-    method public android.app.Notification.Builder setTimeout(long);
     method public android.app.Notification.Builder setTimeoutAfter(long);
     method public android.app.Notification.Builder setUsesChronometer(boolean);
     method public deprecated android.app.Notification.Builder setVibrate(long[]);
@@ -5669,7 +5659,6 @@
     ctor public Notification.TvExtender();
     ctor public Notification.TvExtender(android.app.Notification);
     method public android.app.Notification.Builder extend(android.app.Notification.Builder);
-    method public java.lang.String getChannel();
     method public java.lang.String getChannelId();
     method public android.app.PendingIntent getContentIntent();
     method public android.app.PendingIntent getDeleteIntent();
@@ -5904,21 +5893,10 @@
     method public abstract void onSendFinished(android.app.PendingIntent, android.content.Intent, int, java.lang.String, android.os.Bundle);
   }
 
-  public final deprecated class PictureInPictureArgs extends android.app.PictureInPictureParams {
-    ctor public deprecated PictureInPictureArgs();
-    ctor public deprecated PictureInPictureArgs(float, java.util.List<android.app.RemoteAction>);
-    method public deprecated void setActions(java.util.List<android.app.RemoteAction>);
-    method public deprecated void setAspectRatio(float);
-    method public deprecated void setSourceRectHint(android.graphics.Rect);
-  }
-
-  public class PictureInPictureParams implements android.os.Parcelable {
+  public final class PictureInPictureParams implements android.os.Parcelable {
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.app.PictureInPictureParams> CREATOR;
-    field protected android.util.Rational mAspectRatio;
-    field protected android.graphics.Rect mSourceRectHint;
-    field protected java.util.List<android.app.RemoteAction> mUserActions;
   }
 
   public static class PictureInPictureParams.Builder {
@@ -9855,15 +9833,12 @@
     field public static final java.lang.String ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON";
     field public static final java.lang.String ACTION_CARRIER_SETUP = "android.intent.action.CARRIER_SETUP";
     field public static final java.lang.String ACTION_CHOOSER = "android.intent.action.CHOOSER";
-    field public static final java.lang.String ACTION_CLEAR_PACKAGE = "android.intent.action.CLEAR_PACKAGE";
     field public static final java.lang.String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS";
     field public static final java.lang.String ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED";
     field public static final java.lang.String ACTION_CREATE_DOCUMENT = "android.intent.action.CREATE_DOCUMENT";
     field public static final java.lang.String ACTION_CREATE_SHORTCUT = "android.intent.action.CREATE_SHORTCUT";
     field public static final java.lang.String ACTION_DATE_CHANGED = "android.intent.action.DATE_CHANGED";
     field public static final java.lang.String ACTION_DEFAULT = "android.intent.action.VIEW";
-    field public static final java.lang.String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED = "android.intent.action.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED";
-    field public static final java.lang.String ACTION_DEFAULT_SUBSCRIPTION_CHANGED = "android.intent.action.ACTION_DEFAULT_SUBSCRIPTION_CHANGED";
     field public static final java.lang.String ACTION_DELETE = "android.intent.action.DELETE";
     field public static final deprecated java.lang.String ACTION_DEVICE_INITIALIZATION_WIZARD = "android.intent.action.DEVICE_INITIALIZATION_WIZARD";
     field public static final deprecated java.lang.String ACTION_DEVICE_STORAGE_LOW = "android.intent.action.DEVICE_STORAGE_LOW";
@@ -10116,7 +10091,6 @@
     field public static final java.lang.String EXTRA_SPLIT_NAME = "android.intent.extra.SPLIT_NAME";
     field public static final java.lang.String EXTRA_STREAM = "android.intent.extra.STREAM";
     field public static final java.lang.String EXTRA_SUBJECT = "android.intent.extra.SUBJECT";
-    field public static final java.lang.String EXTRA_SUBSCRIPTION_INDEX = "android.intent.extra.SUBSCRIPTION_INDEX";
     field public static final deprecated java.lang.String EXTRA_SYSTEM_ID = "systemId";
     field public static final java.lang.String EXTRA_TEMPLATE = "android.intent.extra.TEMPLATE";
     field public static final java.lang.String EXTRA_TEXT = "android.intent.extra.TEXT";
@@ -11680,8 +11654,8 @@
     field public android.content.pm.ActivityInfo activityInfo;
     field public android.content.IntentFilter filter;
     field public int icon;
-    field public boolean instantAppAvailable;
     field public boolean isDefault;
+    field public boolean isInstantAppAvailable;
     field public int labelRes;
     field public int match;
     field public java.lang.CharSequence nonLocalizedLabel;
@@ -11718,7 +11692,7 @@
     method public java.util.List<android.content.pm.VersionedPackage> getDependentPackages();
     method public java.lang.String getName();
     method public int getType();
-    method public long getVersion();
+    method public int getVersion();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.content.pm.SharedLibraryInfo> CREATOR;
     field public static final int TYPE_BUILTIN = 0; // 0x0
@@ -14619,6 +14593,7 @@
 package android.graphics.drawable {
 
   public class AdaptiveIconDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+    ctor public AdaptiveIconDrawable(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
     method public void draw(android.graphics.Canvas);
     method public android.graphics.drawable.Drawable getBackground();
     method public static float getExtraInsetFraction();
@@ -27781,17 +27756,6 @@
     field public static final android.os.Parcelable.Creator<android.net.Network> CREATOR;
   }
 
-  public class NetworkBadging {
-    method public static android.graphics.drawable.Drawable getWifiIcon(int, int, android.content.res.Resources.Theme);
-    field public static final int BADGING_4K = 30; // 0x1e
-    field public static final int BADGING_HD = 20; // 0x14
-    field public static final int BADGING_NONE = 0; // 0x0
-    field public static final int BADGING_SD = 10; // 0xa
-  }
-
-  public static abstract class NetworkBadging.Badging implements java.lang.annotation.Annotation {
-  }
-
   public final class NetworkCapabilities implements android.os.Parcelable {
     ctor public NetworkCapabilities(android.net.NetworkCapabilities);
     method public int describeContents();
@@ -27886,17 +27850,9 @@
   }
 
   public abstract class NetworkRecommendationProvider {
-    ctor public deprecated NetworkRecommendationProvider(android.os.Handler);
     ctor public NetworkRecommendationProvider(android.content.Context, java.util.concurrent.Executor);
     method public final android.os.IBinder getBinder();
-    method public deprecated void onRequestRecommendation(android.net.RecommendationRequest, android.net.NetworkRecommendationProvider.ResultCallback);
     method public abstract void onRequestScores(android.net.NetworkKey[]);
-    field public static final deprecated java.lang.String EXTRA_RECOMMENDATION_RESULT = "android.net.extra.RECOMMENDATION_RESULT";
-    field public static final deprecated java.lang.String EXTRA_SEQUENCE = "android.net.extra.SEQUENCE";
-  }
-
-  public static deprecated class NetworkRecommendationProvider.ResultCallback {
-    method public void onResult(android.net.RecommendationResult);
   }
 
   public class NetworkRequest implements android.os.Parcelable {
@@ -27962,41 +27918,6 @@
     field public static final android.os.Parcelable.Creator<android.net.ProxyInfo> CREATOR;
   }
 
-  public final deprecated class RecommendationRequest implements android.os.Parcelable {
-    ctor protected RecommendationRequest(android.os.Parcel);
-    method public int describeContents();
-    method public android.net.wifi.WifiConfiguration[] getConnectableConfigs();
-    method public android.net.wifi.WifiConfiguration getConnectedConfig();
-    method public android.net.wifi.WifiConfiguration getDefaultWifiConfig();
-    method public int getLastSelectedNetworkId();
-    method public long getLastSelectedNetworkTimestamp();
-    method public android.net.wifi.ScanResult[] getScanResults();
-    method public void setConnectableConfigs(android.net.wifi.WifiConfiguration[]);
-    method public void setConnectedConfig(android.net.wifi.WifiConfiguration);
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.RecommendationRequest> CREATOR;
-  }
-
-  public static final deprecated class RecommendationRequest.Builder {
-    ctor public RecommendationRequest.Builder();
-    method public android.net.RecommendationRequest build();
-    method public android.net.RecommendationRequest.Builder setConnectableConfigs(android.net.wifi.WifiConfiguration[]);
-    method public android.net.RecommendationRequest.Builder setConnectedWifiConfig(android.net.wifi.WifiConfiguration);
-    method public android.net.RecommendationRequest.Builder setDefaultWifiConfig(android.net.wifi.WifiConfiguration);
-    method public android.net.RecommendationRequest.Builder setLastSelectedNetwork(int, long);
-    method public android.net.RecommendationRequest.Builder setScanResults(android.net.wifi.ScanResult[]);
-  }
-
-  public final deprecated class RecommendationResult implements android.os.Parcelable {
-    method public static android.net.RecommendationResult createConnectRecommendation(android.net.wifi.WifiConfiguration);
-    method public static android.net.RecommendationResult createDoNotConnectRecommendation();
-    method public int describeContents();
-    method public android.net.wifi.WifiConfiguration getWifiConfiguration();
-    method public boolean hasRecommendation();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.RecommendationResult> CREATOR;
-  }
-
   public final class RouteInfo implements android.os.Parcelable {
     method public int describeContents();
     method public android.net.IpPrefix getDestination();
@@ -29131,6 +29052,7 @@
     method public boolean setWifiApConfiguration(android.net.wifi.WifiConfiguration);
     method public boolean setWifiApEnabled(android.net.wifi.WifiConfiguration, boolean);
     method public boolean setWifiEnabled(boolean);
+    method public void startLocalOnlyHotspot(android.net.wifi.WifiManager.LocalOnlyHotspotCallback, android.os.Handler);
     method public deprecated boolean startLocationRestrictedScan(android.os.WorkSource);
     method public boolean startScan();
     method public boolean startScan(android.os.WorkSource);
@@ -29208,6 +29130,22 @@
     method public abstract void onSuccess();
   }
 
+  public static class WifiManager.LocalOnlyHotspotCallback {
+    ctor public WifiManager.LocalOnlyHotspotCallback();
+    method public void onFailed(int);
+    method public void onStarted(android.net.wifi.WifiManager.LocalOnlyHotspotReservation);
+    method public void onStopped();
+    field public static final int ERROR_GENERIC = 2; // 0x2
+    field public static final int ERROR_INCOMPATIBLE_MODE = 3; // 0x3
+    field public static final int ERROR_NO_CHANNEL = 1; // 0x1
+    field public static final int ERROR_TETHERING_DISALLOWED = 4; // 0x4
+  }
+
+  public class WifiManager.LocalOnlyHotspotReservation implements java.lang.AutoCloseable {
+    method public void close();
+    method public android.net.wifi.WifiConfiguration getWifiConfiguration();
+  }
+
   public class WifiManager.MulticastLock {
     method public void acquire();
     method public boolean isHeld();
@@ -29515,28 +29453,28 @@
     method public int getCredentialPriority();
     method public android.net.wifi.hotspot2.pps.HomeSp getHomeSp();
     method public android.net.wifi.hotspot2.pps.Policy getPolicy();
-    method public long getSubscriptionCreationTimeInMs();
-    method public long getSubscriptionExpirationTimeInMs();
+    method public long getSubscriptionCreationTimeInMillis();
+    method public long getSubscriptionExpirationTimeInMillis();
     method public java.lang.String getSubscriptionType();
     method public android.net.wifi.hotspot2.pps.UpdateParameter getSubscriptionUpdate();
     method public java.util.Map<java.lang.String, byte[]> getTrustRootCertList();
     method public int getUpdateIdentifier();
     method public long getUsageLimitDataLimit();
-    method public long getUsageLimitStartTimeInMs();
+    method public long getUsageLimitStartTimeInMillis();
     method public long getUsageLimitTimeLimitInMinutes();
     method public long getUsageLimitUsageTimePeriodInMinutes();
     method public void setCredential(android.net.wifi.hotspot2.pps.Credential);
     method public void setCredentialPriority(int);
     method public void setHomeSp(android.net.wifi.hotspot2.pps.HomeSp);
     method public void setPolicy(android.net.wifi.hotspot2.pps.Policy);
-    method public void setSubscriptionCreationTimeInMs(long);
-    method public void setSubscriptionExpirationTimeInMs(long);
+    method public void setSubscriptionCreationTimeInMillis(long);
+    method public void setSubscriptionExpirationTimeInMillis(long);
     method public void setSubscriptionType(java.lang.String);
     method public void setSubscriptionUpdate(android.net.wifi.hotspot2.pps.UpdateParameter);
     method public void setTrustRootCertList(java.util.Map<java.lang.String, byte[]>);
     method public void setUpdateIdentifier(int);
     method public void setUsageLimitDataLimit(long);
-    method public void setUsageLimitStartTimeInMs(long);
+    method public void setUsageLimitStartTimeInMillis(long);
     method public void setUsageLimitTimeLimitInMinutes(long);
     method public void setUsageLimitUsageTimePeriodInMinutes(long);
     method public void writeToParcel(android.os.Parcel, int);
@@ -29564,8 +29502,8 @@
     method public boolean getCheckAaaServerCertStatus();
     method public java.security.cert.X509Certificate[] getClientCertificateChain();
     method public java.security.PrivateKey getClientPrivateKey();
-    method public long getCreationTimeInMs();
-    method public long getExpirationTimeInMs();
+    method public long getCreationTimeInMillis();
+    method public long getExpirationTimeInMillis();
     method public java.lang.String getRealm();
     method public android.net.wifi.hotspot2.pps.Credential.SimCredential getSimCredential();
     method public android.net.wifi.hotspot2.pps.Credential.UserCredential getUserCredential();
@@ -29574,8 +29512,8 @@
     method public void setCheckAaaServerCertStatus(boolean);
     method public void setClientCertificateChain(java.security.cert.X509Certificate[]);
     method public void setClientPrivateKey(java.security.PrivateKey);
-    method public void setCreationTimeInMs(long);
-    method public void setExpirationTimeInMs(long);
+    method public void setCreationTimeInMillis(long);
+    method public void setExpirationTimeInMillis(long);
     method public void setRealm(java.lang.String);
     method public void setSimCredential(android.net.wifi.hotspot2.pps.Credential.SimCredential);
     method public void setUserCredential(android.net.wifi.hotspot2.pps.Credential.UserCredential);
@@ -34427,7 +34365,7 @@
 
   public class TestLooperManager {
     method public void execute(android.os.Message);
-    method public android.os.MessageQueue getQueue();
+    method public android.os.MessageQueue getMessageQueue();
     method public boolean hasMessages(android.os.Handler, java.lang.Object, int);
     method public boolean hasMessages(android.os.Handler, java.lang.Object, java.lang.Runnable);
     method public android.os.Message next();
@@ -40136,7 +40074,7 @@
   public final class FillRequest implements android.os.Parcelable {
     method public int describeContents();
     method public android.os.Bundle getClientState();
-    method public java.util.ArrayList<android.service.autofill.FillContext> getFillContexts();
+    method public java.util.List<android.service.autofill.FillContext> getFillContexts();
     method public int getFlags();
     method public int getId();
     method public void writeToParcel(android.os.Parcel, int);
@@ -41261,7 +41199,6 @@
     method public void onRangeStart(java.lang.String, int, int, int);
     method public abstract void onStart(java.lang.String);
     method public void onStop(java.lang.String, boolean);
-    method public deprecated void onUtteranceRangeStart(java.lang.String, int, int);
   }
 
   public class Voice implements android.os.Parcelable {
@@ -43562,8 +43499,11 @@
     method public static int getDefaultVoiceSubscriptionId();
     method public boolean isNetworkRoaming(int);
     method public void removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
+    field public static final java.lang.String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED = "android.telephony.action.DEFAULT_SMS_SUBSCRIPTION_CHANGED";
+    field public static final java.lang.String ACTION_DEFAULT_SUBSCRIPTION_CHANGED = "android.telephony.action.DEFAULT_SUBSCRIPTION_CHANGED";
     field public static final int DATA_ROAMING_DISABLE = 0; // 0x0
     field public static final int DATA_ROAMING_ENABLE = 1; // 0x1
+    field public static final java.lang.String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX";
     field public static final int INVALID_SUBSCRIPTION_ID = -1; // 0xffffffff
   }
 
@@ -51365,7 +51305,7 @@
     method public void unregisterCallback(android.view.autofill.AutofillManager.AutofillCallback);
     field public static final java.lang.String EXTRA_ASSIST_STRUCTURE = "android.view.autofill.extra.ASSIST_STRUCTURE";
     field public static final java.lang.String EXTRA_AUTHENTICATION_RESULT = "android.view.autofill.extra.AUTHENTICATION_RESULT";
-    field public static final java.lang.String EXTRA_CLIENT_STATE = "android.view.autofill.extra.EXTRA_CLIENT_STATE";
+    field public static final java.lang.String EXTRA_CLIENT_STATE = "android.view.autofill.extra.CLIENT_STATE";
   }
 
   public static abstract class AutofillManager.AutofillCallback {
diff --git a/api/system-removed.txt b/api/system-removed.txt
index fe51248..60865a3 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -1,9 +1,59 @@
 package android.app {
 
+  public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
+    method public deprecated boolean enterPictureInPictureMode(android.app.PictureInPictureArgs);
+    method public deprecated void setPictureInPictureArgs(android.app.PictureInPictureArgs);
+  }
+
+  public class ActivityManager {
+    method public static deprecated int getMaxNumPictureInPictureActions();
+  }
+
+  public class KeyguardManager {
+    method public deprecated void dismissKeyguard(android.app.Activity, android.app.KeyguardManager.KeyguardDismissCallback, android.os.Handler);
+  }
+
   public class Notification implements android.os.Parcelable {
+    method public deprecated java.lang.String getChannel();
+    method public deprecated long getTimeout();
     method public deprecated void setLatestEventInfo(android.content.Context, java.lang.CharSequence, java.lang.CharSequence, android.app.PendingIntent);
   }
 
+  public static class Notification.Builder {
+    method public deprecated android.app.Notification.Builder setChannel(java.lang.String);
+    method public deprecated android.app.Notification.Builder setTimeout(long);
+  }
+
+  public static final class Notification.TvExtender implements android.app.Notification.Extender {
+    method public deprecated java.lang.String getChannel();
+  }
+
+  public final deprecated class PictureInPictureArgs implements android.os.Parcelable {
+    method public static android.app.PictureInPictureArgs convert(android.app.PictureInPictureParams);
+    method public static android.app.PictureInPictureParams convert(android.app.PictureInPictureArgs);
+    method public void copyOnlySet(android.app.PictureInPictureArgs);
+    method public java.util.List<android.app.RemoteAction> getActions();
+    method public float getAspectRatio();
+    method public android.util.Rational getAspectRatioRational();
+    method public android.graphics.Rect getSourceRectHint();
+    method public android.graphics.Rect getSourceRectHintInsets();
+    method public boolean hasSetActions();
+    method public boolean hasSetAspectRatio();
+    method public boolean hasSourceBoundsHint();
+    method public boolean hasSourceBoundsHintInsets();
+    method public deprecated void setSourceRectHintInsets(android.graphics.Rect);
+    method public void truncateActions(int);
+    field public static final android.os.Parcelable.Creator<android.app.PictureInPictureArgs> CREATOR;
+  }
+
+  public static class PictureInPictureArgs.Builder {
+    ctor public PictureInPictureArgs.Builder();
+    method public android.app.PictureInPictureArgs build();
+    method public android.app.PictureInPictureArgs.Builder setActions(java.util.List<android.app.RemoteAction>);
+    method public android.app.PictureInPictureArgs.Builder setAspectRatio(android.util.Rational);
+    method public android.app.PictureInPictureArgs.Builder setSourceRectHint(android.graphics.Rect);
+  }
+
   public final class RecoverableSecurityException extends java.lang.SecurityException implements android.os.Parcelable {
     method public deprecated void showAsNotification(android.content.Context);
   }
@@ -74,6 +124,10 @@
     method public abstract boolean setInstantAppCookie(byte[]);
   }
 
+  public class ResolveInfo implements android.os.Parcelable {
+    field public deprecated boolean instantAppAvailable;
+  }
+
   public final class SharedLibraryInfo implements android.os.Parcelable {
     method public boolean isBuiltin();
     method public boolean isDynamic();
@@ -186,6 +240,26 @@
     method public deprecated int stopUsingNetworkFeature(int, java.lang.String);
   }
 
+  public deprecated class NetworkBadging {
+    method public static android.graphics.drawable.Drawable getWifiIcon(int, int, android.content.res.Resources.Theme);
+    field public static final int BADGING_4K = 30; // 0x1e
+    field public static final int BADGING_HD = 20; // 0x14
+    field public static final int BADGING_NONE = 0; // 0x0
+    field public static final int BADGING_SD = 10; // 0xa
+  }
+
+  public abstract class NetworkRecommendationProvider {
+    ctor public deprecated NetworkRecommendationProvider(android.os.Handler);
+    method public deprecated void onRequestRecommendation(android.net.RecommendationRequest, android.net.NetworkRecommendationProvider.ResultCallback);
+    field public static final deprecated java.lang.String EXTRA_RECOMMENDATION_RESULT = "android.net.extra.RECOMMENDATION_RESULT";
+    field public static final deprecated java.lang.String EXTRA_SEQUENCE = "android.net.extra.SEQUENCE";
+  }
+
+  public static deprecated class NetworkRecommendationProvider.ResultCallback {
+    ctor public NetworkRecommendationProvider.ResultCallback(android.os.IRemoteCallback, int);
+    method public void onResult(android.net.RecommendationResult);
+  }
+
   public abstract class PskKeyManager {
     ctor public PskKeyManager();
     field public static final int MAX_IDENTITY_HINT_LENGTH_BYTES = 128; // 0x80
@@ -193,6 +267,37 @@
     field public static final int MAX_KEY_LENGTH_BYTES = 256; // 0x100
   }
 
+  public final deprecated class RecommendationRequest implements android.os.Parcelable {
+    ctor protected RecommendationRequest(android.os.Parcel);
+    method public android.net.wifi.WifiConfiguration[] getConnectableConfigs();
+    method public android.net.wifi.WifiConfiguration getConnectedConfig();
+    method public android.net.wifi.WifiConfiguration getDefaultWifiConfig();
+    method public int getLastSelectedNetworkId();
+    method public long getLastSelectedNetworkTimestamp();
+    method public android.net.wifi.ScanResult[] getScanResults();
+    method public void setConnectableConfigs(android.net.wifi.WifiConfiguration[]);
+    method public void setConnectedConfig(android.net.wifi.WifiConfiguration);
+    field public static final android.os.Parcelable.Creator<android.net.RecommendationRequest> CREATOR;
+  }
+
+  public static final deprecated class RecommendationRequest.Builder {
+    ctor public RecommendationRequest.Builder();
+    method public android.net.RecommendationRequest build();
+    method public android.net.RecommendationRequest.Builder setConnectableConfigs(android.net.wifi.WifiConfiguration[]);
+    method public android.net.RecommendationRequest.Builder setConnectedWifiConfig(android.net.wifi.WifiConfiguration);
+    method public android.net.RecommendationRequest.Builder setDefaultWifiConfig(android.net.wifi.WifiConfiguration);
+    method public android.net.RecommendationRequest.Builder setLastSelectedNetwork(int, long);
+    method public android.net.RecommendationRequest.Builder setScanResults(android.net.wifi.ScanResult[]);
+  }
+
+  public final deprecated class RecommendationResult implements android.os.Parcelable {
+    method public static android.net.RecommendationResult createConnectRecommendation(android.net.wifi.WifiConfiguration);
+    method public static android.net.RecommendationResult createDoNotConnectRecommendation();
+    method public android.net.wifi.WifiConfiguration getWifiConfiguration();
+    method public boolean hasRecommendation();
+    field public static final android.os.Parcelable.Creator<android.net.RecommendationResult> CREATOR;
+  }
+
   public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {
     method public static deprecated org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int, android.net.SSLSessionCache);
   }
@@ -215,6 +320,10 @@
     ctor public RecoverySystem();
   }
 
+  public class TestLooperManager {
+    method public deprecated android.os.MessageQueue getQueue();
+  }
+
   public class UserManager {
     method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle, android.graphics.Rect, int);
     method public android.graphics.drawable.Drawable getBadgedIconForUser(android.graphics.drawable.Drawable, android.os.UserHandle);
@@ -376,6 +485,14 @@
 
 }
 
+package android.speech.tts {
+
+  public abstract class UtteranceProgressListener {
+    method public deprecated void onUtteranceRangeStart(java.lang.String, int, int);
+  }
+
+}
+
 package android.test.mock {
 
   public deprecated class MockPackageManager extends android.content.pm.PackageManager {
diff --git a/api/test-current.txt b/api/test-current.txt
index 5bc666e..27419698 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -1061,6 +1061,7 @@
     field public static final int ratingBarStyleSmall = 16842877; // 0x101007d
     field public static final int readPermission = 16842759; // 0x1010007
     field public static final int recognitionService = 16843932; // 0x101049c
+    field public static final int recreateOnConfigChanges = 16844105; // 0x1010549
     field public static final int recycleEnabled = 16844124; // 0x101055c
     field public static final int relinquishTaskIdentity = 16843894; // 0x1010476
     field public static final int reparent = 16843964; // 0x10104bc
@@ -1085,7 +1086,6 @@
     field public static final int resizeable = 16843405; // 0x101028d
     field public static final int resizeableActivity = 16844022; // 0x10104f6
     field public static final int resource = 16842789; // 0x1010025
-    field public static final int restartOnConfigChanges = 16844105; // 0x1010549
     field public static final int restoreAnyVersion = 16843450; // 0x10102ba
     field public static final deprecated int restoreNeedsApplication = 16843421; // 0x101029d
     field public static final int restrictedAccountType = 16843733; // 0x10103d5
@@ -1708,7 +1708,6 @@
     field public static final int ic_notification_clear_all = 17301594; // 0x108005a
     field public static final int ic_notification_overlay = 17301595; // 0x108005b
     field public static final int ic_partial_secure = 17301596; // 0x108005c
-    field public static final int ic_picture_in_picture = 17301685; // 0x10800b5
     field public static final int ic_popup_disk_full = 17301597; // 0x108005d
     field public static final int ic_popup_reminder = 17301598; // 0x108005e
     field public static final int ic_popup_sync = 17301599; // 0x108005f
@@ -2829,7 +2828,7 @@
     method public android.content.pm.ResolveInfo getResolveInfo();
     method public java.lang.String getSettingsActivityName();
     method public java.lang.String loadDescription(android.content.pm.PackageManager);
-    method public java.lang.String loadSummary(android.content.pm.PackageManager);
+    method public java.lang.CharSequence loadSummary(android.content.pm.PackageManager);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int CAPABILITY_CAN_CONTROL_MAGNIFICATION = 16; // 0x10
     field public static final int CAPABILITY_CAN_PERFORM_GESTURES = 32; // 0x20
@@ -3582,7 +3581,6 @@
     method public boolean dispatchTrackballEvent(android.view.MotionEvent);
     method public void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
     method public deprecated void enterPictureInPictureMode();
-    method public deprecated boolean enterPictureInPictureMode(android.app.PictureInPictureArgs);
     method public boolean enterPictureInPictureMode(android.app.PictureInPictureParams);
     method public <T extends android.view.View> T findViewById(int);
     method public void finish();
@@ -3757,7 +3755,6 @@
     method public void setImmersive(boolean);
     method public void setIntent(android.content.Intent);
     method public final void setMediaController(android.media.session.MediaController);
-    method public void setPictureInPictureArgs(android.app.PictureInPictureArgs);
     method public void setPictureInPictureParams(android.app.PictureInPictureParams);
     method public final deprecated void setProgress(int);
     method public final deprecated void setProgressBarIndeterminate(boolean);
@@ -3838,7 +3835,6 @@
     method public int getLauncherLargeIconDensity();
     method public int getLauncherLargeIconSize();
     method public int getLockTaskModeState();
-    method public static deprecated int getMaxNumPictureInPictureActions();
     method public int getMemoryClass();
     method public void getMemoryInfo(android.app.ActivityManager.MemoryInfo);
     method public static void getMyMemoryState(android.app.ActivityManager.RunningAppProcessInfo);
@@ -4712,7 +4708,6 @@
 
   public abstract class FragmentContainer {
     ctor public FragmentContainer();
-    method public android.app.Fragment instantiate(android.content.Context, java.lang.String, android.os.Bundle);
     method public abstract <T extends android.view.View> T onFindViewById(int);
     method public abstract boolean onHasView();
   }
@@ -4985,7 +4980,6 @@
 
   public class KeyguardManager {
     method public android.content.Intent createConfirmDeviceCredentialIntent(java.lang.CharSequence, java.lang.CharSequence);
-    method public deprecated void dismissKeyguard(android.app.Activity, android.app.KeyguardManager.KeyguardDismissCallback, android.os.Handler);
     method public deprecated void exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult);
     method public boolean inKeyguardRestrictedInputMode();
     method public boolean isDeviceLocked();
@@ -5134,7 +5128,6 @@
     method public android.app.Notification clone();
     method public int describeContents();
     method public int getBadgeIconType();
-    method public java.lang.String getChannel();
     method public java.lang.String getChannelId();
     method public java.lang.String getGroup();
     method public int getGroupAlertBehavior();
@@ -5143,7 +5136,6 @@
     method public java.lang.String getShortcutId();
     method public android.graphics.drawable.Icon getSmallIcon();
     method public java.lang.String getSortKey();
-    method public long getTimeout();
     method public long getTimeoutAfter();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.media.AudioAttributes AUDIO_ATTRIBUTES_DEFAULT;
@@ -5346,7 +5338,6 @@
     method public android.app.Notification.Builder setAutoCancel(boolean);
     method public android.app.Notification.Builder setBadgeIconType(int);
     method public android.app.Notification.Builder setCategory(java.lang.String);
-    method public android.app.Notification.Builder setChannel(java.lang.String);
     method public android.app.Notification.Builder setChannelId(java.lang.String);
     method public android.app.Notification.Builder setChronometerCountDown(boolean);
     method public android.app.Notification.Builder setColor(int);
@@ -5391,7 +5382,6 @@
     method public android.app.Notification.Builder setSubText(java.lang.CharSequence);
     method public android.app.Notification.Builder setTicker(java.lang.CharSequence);
     method public deprecated android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
-    method public android.app.Notification.Builder setTimeout(long);
     method public android.app.Notification.Builder setTimeoutAfter(long);
     method public android.app.Notification.Builder setUsesChronometer(boolean);
     method public deprecated android.app.Notification.Builder setVibrate(long[]);
@@ -5711,21 +5701,10 @@
     method public abstract void onSendFinished(android.app.PendingIntent, android.content.Intent, int, java.lang.String, android.os.Bundle);
   }
 
-  public final deprecated class PictureInPictureArgs extends android.app.PictureInPictureParams {
-    ctor public deprecated PictureInPictureArgs();
-    ctor public deprecated PictureInPictureArgs(float, java.util.List<android.app.RemoteAction>);
-    method public deprecated void setActions(java.util.List<android.app.RemoteAction>);
-    method public deprecated void setAspectRatio(float);
-    method public deprecated void setSourceRectHint(android.graphics.Rect);
-  }
-
-  public class PictureInPictureParams implements android.os.Parcelable {
+  public final class PictureInPictureParams implements android.os.Parcelable {
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.app.PictureInPictureParams> CREATOR;
-    field protected android.util.Rational mAspectRatio;
-    field protected android.graphics.Rect mSourceRectHint;
-    field protected java.util.List<android.app.RemoteAction> mUserActions;
   }
 
   public static class PictureInPictureParams.Builder {
@@ -9363,15 +9342,12 @@
     field public static final java.lang.String ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON";
     field public static final java.lang.String ACTION_CARRIER_SETUP = "android.intent.action.CARRIER_SETUP";
     field public static final java.lang.String ACTION_CHOOSER = "android.intent.action.CHOOSER";
-    field public static final java.lang.String ACTION_CLEAR_PACKAGE = "android.intent.action.CLEAR_PACKAGE";
     field public static final java.lang.String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS";
     field public static final java.lang.String ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED";
     field public static final java.lang.String ACTION_CREATE_DOCUMENT = "android.intent.action.CREATE_DOCUMENT";
     field public static final java.lang.String ACTION_CREATE_SHORTCUT = "android.intent.action.CREATE_SHORTCUT";
     field public static final java.lang.String ACTION_DATE_CHANGED = "android.intent.action.DATE_CHANGED";
     field public static final java.lang.String ACTION_DEFAULT = "android.intent.action.VIEW";
-    field public static final java.lang.String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED = "android.intent.action.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED";
-    field public static final java.lang.String ACTION_DEFAULT_SUBSCRIPTION_CHANGED = "android.intent.action.ACTION_DEFAULT_SUBSCRIPTION_CHANGED";
     field public static final java.lang.String ACTION_DELETE = "android.intent.action.DELETE";
     field public static final deprecated java.lang.String ACTION_DEVICE_STORAGE_LOW = "android.intent.action.DEVICE_STORAGE_LOW";
     field public static final deprecated java.lang.String ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK";
@@ -9575,7 +9551,6 @@
     field public static final java.lang.String EXTRA_SHUTDOWN_USERSPACE_ONLY = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY";
     field public static final java.lang.String EXTRA_STREAM = "android.intent.extra.STREAM";
     field public static final java.lang.String EXTRA_SUBJECT = "android.intent.extra.SUBJECT";
-    field public static final java.lang.String EXTRA_SUBSCRIPTION_INDEX = "android.intent.extra.SUBSCRIPTION_INDEX";
     field public static final java.lang.String EXTRA_TEMPLATE = "android.intent.extra.TEMPLATE";
     field public static final java.lang.String EXTRA_TEXT = "android.intent.extra.TEXT";
     field public static final java.lang.String EXTRA_TITLE = "android.intent.extra.TITLE";
@@ -10954,8 +10929,8 @@
     field public android.content.pm.ActivityInfo activityInfo;
     field public android.content.IntentFilter filter;
     field public int icon;
-    field public boolean instantAppAvailable;
     field public boolean isDefault;
+    field public boolean isInstantAppAvailable;
     field public int labelRes;
     field public int match;
     field public java.lang.CharSequence nonLocalizedLabel;
@@ -10992,7 +10967,7 @@
     method public java.util.List<android.content.pm.VersionedPackage> getDependentPackages();
     method public java.lang.String getName();
     method public int getType();
-    method public long getVersion();
+    method public int getVersion();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.content.pm.SharedLibraryInfo> CREATOR;
     field public static final int TYPE_BUILTIN = 0; // 0x0
@@ -13880,6 +13855,7 @@
 package android.graphics.drawable {
 
   public class AdaptiveIconDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+    ctor public AdaptiveIconDrawable(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
     method public void draw(android.graphics.Canvas);
     method public android.graphics.drawable.Drawable getBackground();
     method public static float getExtraInsetFraction();
@@ -13893,6 +13869,7 @@
     method public void setColorFilter(android.graphics.ColorFilter);
     method public void setOpacity(int);
     method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable);
+    field public static final float MASK_SIZE = 100.0f;
   }
 
   public abstract interface Animatable {
@@ -26657,6 +26634,7 @@
     method public void setTdlsEnabled(java.net.InetAddress, boolean);
     method public void setTdlsEnabledWithMacAddress(java.lang.String, boolean);
     method public boolean setWifiEnabled(boolean);
+    method public void startLocalOnlyHotspot(android.net.wifi.WifiManager.LocalOnlyHotspotCallback, android.os.Handler);
     method public boolean startScan();
     method public void startWps(android.net.wifi.WpsInfo, android.net.wifi.WifiManager.WpsCallback);
     method public int updateNetwork(android.net.wifi.WifiConfiguration);
@@ -26707,6 +26685,22 @@
     field public static final int WPS_WEP_PROHIBITED = 4; // 0x4
   }
 
+  public static class WifiManager.LocalOnlyHotspotCallback {
+    ctor public WifiManager.LocalOnlyHotspotCallback();
+    method public void onFailed(int);
+    method public void onStarted(android.net.wifi.WifiManager.LocalOnlyHotspotReservation);
+    method public void onStopped();
+    field public static final int ERROR_GENERIC = 2; // 0x2
+    field public static final int ERROR_INCOMPATIBLE_MODE = 3; // 0x3
+    field public static final int ERROR_NO_CHANNEL = 1; // 0x1
+    field public static final int ERROR_TETHERING_DISALLOWED = 4; // 0x4
+  }
+
+  public class WifiManager.LocalOnlyHotspotReservation implements java.lang.AutoCloseable {
+    method public void close();
+    method public android.net.wifi.WifiConfiguration getWifiConfiguration();
+  }
+
   public class WifiManager.MulticastLock {
     method public void acquire();
     method public boolean isHeld();
@@ -26872,28 +26866,28 @@
     method public int getCredentialPriority();
     method public android.net.wifi.hotspot2.pps.HomeSp getHomeSp();
     method public android.net.wifi.hotspot2.pps.Policy getPolicy();
-    method public long getSubscriptionCreationTimeInMs();
-    method public long getSubscriptionExpirationTimeInMs();
+    method public long getSubscriptionCreationTimeInMillis();
+    method public long getSubscriptionExpirationTimeInMillis();
     method public java.lang.String getSubscriptionType();
     method public android.net.wifi.hotspot2.pps.UpdateParameter getSubscriptionUpdate();
     method public java.util.Map<java.lang.String, byte[]> getTrustRootCertList();
     method public int getUpdateIdentifier();
     method public long getUsageLimitDataLimit();
-    method public long getUsageLimitStartTimeInMs();
+    method public long getUsageLimitStartTimeInMillis();
     method public long getUsageLimitTimeLimitInMinutes();
     method public long getUsageLimitUsageTimePeriodInMinutes();
     method public void setCredential(android.net.wifi.hotspot2.pps.Credential);
     method public void setCredentialPriority(int);
     method public void setHomeSp(android.net.wifi.hotspot2.pps.HomeSp);
     method public void setPolicy(android.net.wifi.hotspot2.pps.Policy);
-    method public void setSubscriptionCreationTimeInMs(long);
-    method public void setSubscriptionExpirationTimeInMs(long);
+    method public void setSubscriptionCreationTimeInMillis(long);
+    method public void setSubscriptionExpirationTimeInMillis(long);
     method public void setSubscriptionType(java.lang.String);
     method public void setSubscriptionUpdate(android.net.wifi.hotspot2.pps.UpdateParameter);
     method public void setTrustRootCertList(java.util.Map<java.lang.String, byte[]>);
     method public void setUpdateIdentifier(int);
     method public void setUsageLimitDataLimit(long);
-    method public void setUsageLimitStartTimeInMs(long);
+    method public void setUsageLimitStartTimeInMillis(long);
     method public void setUsageLimitTimeLimitInMinutes(long);
     method public void setUsageLimitUsageTimePeriodInMinutes(long);
     method public void writeToParcel(android.os.Parcel, int);
@@ -26921,8 +26915,8 @@
     method public boolean getCheckAaaServerCertStatus();
     method public java.security.cert.X509Certificate[] getClientCertificateChain();
     method public java.security.PrivateKey getClientPrivateKey();
-    method public long getCreationTimeInMs();
-    method public long getExpirationTimeInMs();
+    method public long getCreationTimeInMillis();
+    method public long getExpirationTimeInMillis();
     method public java.lang.String getRealm();
     method public android.net.wifi.hotspot2.pps.Credential.SimCredential getSimCredential();
     method public android.net.wifi.hotspot2.pps.Credential.UserCredential getUserCredential();
@@ -26931,8 +26925,8 @@
     method public void setCheckAaaServerCertStatus(boolean);
     method public void setClientCertificateChain(java.security.cert.X509Certificate[]);
     method public void setClientPrivateKey(java.security.PrivateKey);
-    method public void setCreationTimeInMs(long);
-    method public void setExpirationTimeInMs(long);
+    method public void setCreationTimeInMillis(long);
+    method public void setExpirationTimeInMillis(long);
     method public void setRealm(java.lang.String);
     method public void setSimCredential(android.net.wifi.hotspot2.pps.Credential.SimCredential);
     method public void setUserCredential(android.net.wifi.hotspot2.pps.Credential.UserCredential);
@@ -31731,7 +31725,7 @@
 
   public class TestLooperManager {
     method public void execute(android.os.Message);
-    method public android.os.MessageQueue getQueue();
+    method public android.os.MessageQueue getMessageQueue();
     method public boolean hasMessages(android.os.Handler, java.lang.Object, int);
     method public boolean hasMessages(android.os.Handler, java.lang.Object, java.lang.Runnable);
     method public android.os.Message next();
@@ -37166,7 +37160,7 @@
   public final class FillRequest implements android.os.Parcelable {
     method public int describeContents();
     method public android.os.Bundle getClientState();
-    method public java.util.ArrayList<android.service.autofill.FillContext> getFillContexts();
+    method public java.util.List<android.service.autofill.FillContext> getFillContexts();
     method public int getFlags();
     method public int getId();
     method public void writeToParcel(android.os.Parcel, int);
@@ -38189,7 +38183,6 @@
     method public void onRangeStart(java.lang.String, int, int, int);
     method public abstract void onStart(java.lang.String);
     method public void onStop(java.lang.String, boolean);
-    method public deprecated void onUtteranceRangeStart(java.lang.String, int, int);
   }
 
   public class Voice implements android.os.Parcelable {
@@ -40270,8 +40263,11 @@
     method public static int getDefaultVoiceSubscriptionId();
     method public boolean isNetworkRoaming(int);
     method public void removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
+    field public static final java.lang.String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED = "android.telephony.action.DEFAULT_SMS_SUBSCRIPTION_CHANGED";
+    field public static final java.lang.String ACTION_DEFAULT_SUBSCRIPTION_CHANGED = "android.telephony.action.DEFAULT_SUBSCRIPTION_CHANGED";
     field public static final int DATA_ROAMING_DISABLE = 0; // 0x0
     field public static final int DATA_ROAMING_ENABLE = 1; // 0x1
+    field public static final java.lang.String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX";
     field public static final int INVALID_SUBSCRIPTION_ID = -1; // 0xffffffff
   }
 
@@ -48147,7 +48143,7 @@
     method public void unregisterCallback(android.view.autofill.AutofillManager.AutofillCallback);
     field public static final java.lang.String EXTRA_ASSIST_STRUCTURE = "android.view.autofill.extra.ASSIST_STRUCTURE";
     field public static final java.lang.String EXTRA_AUTHENTICATION_RESULT = "android.view.autofill.extra.AUTHENTICATION_RESULT";
-    field public static final java.lang.String EXTRA_CLIENT_STATE = "android.view.autofill.extra.EXTRA_CLIENT_STATE";
+    field public static final java.lang.String EXTRA_CLIENT_STATE = "android.view.autofill.extra.CLIENT_STATE";
   }
 
   public static abstract class AutofillManager.AutofillCallback {
diff --git a/api/test-removed.txt b/api/test-removed.txt
index 779ff7c..1873499 100644
--- a/api/test-removed.txt
+++ b/api/test-removed.txt
@@ -1,9 +1,59 @@
 package android.app {
 
+  public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
+    method public deprecated boolean enterPictureInPictureMode(android.app.PictureInPictureArgs);
+    method public deprecated void setPictureInPictureArgs(android.app.PictureInPictureArgs);
+  }
+
+  public class ActivityManager {
+    method public static deprecated int getMaxNumPictureInPictureActions();
+  }
+
+  public class KeyguardManager {
+    method public deprecated void dismissKeyguard(android.app.Activity, android.app.KeyguardManager.KeyguardDismissCallback, android.os.Handler);
+  }
+
   public class Notification implements android.os.Parcelable {
+    method public deprecated java.lang.String getChannel();
+    method public deprecated long getTimeout();
     method public deprecated void setLatestEventInfo(android.content.Context, java.lang.CharSequence, java.lang.CharSequence, android.app.PendingIntent);
   }
 
+  public static class Notification.Builder {
+    method public deprecated android.app.Notification.Builder setChannel(java.lang.String);
+    method public deprecated android.app.Notification.Builder setTimeout(long);
+  }
+
+  public static final class Notification.TvExtender implements android.app.Notification.Extender {
+    method public deprecated java.lang.String getChannel();
+  }
+
+  public final deprecated class PictureInPictureArgs implements android.os.Parcelable {
+    method public static android.app.PictureInPictureArgs convert(android.app.PictureInPictureParams);
+    method public static android.app.PictureInPictureParams convert(android.app.PictureInPictureArgs);
+    method public void copyOnlySet(android.app.PictureInPictureArgs);
+    method public java.util.List<android.app.RemoteAction> getActions();
+    method public float getAspectRatio();
+    method public android.util.Rational getAspectRatioRational();
+    method public android.graphics.Rect getSourceRectHint();
+    method public android.graphics.Rect getSourceRectHintInsets();
+    method public boolean hasSetActions();
+    method public boolean hasSetAspectRatio();
+    method public boolean hasSourceBoundsHint();
+    method public boolean hasSourceBoundsHintInsets();
+    method public deprecated void setSourceRectHintInsets(android.graphics.Rect);
+    method public void truncateActions(int);
+    field public static final android.os.Parcelable.Creator<android.app.PictureInPictureArgs> CREATOR;
+  }
+
+  public static class PictureInPictureArgs.Builder {
+    ctor public PictureInPictureArgs.Builder();
+    method public android.app.PictureInPictureArgs build();
+    method public android.app.PictureInPictureArgs.Builder setActions(java.util.List<android.app.RemoteAction>);
+    method public android.app.PictureInPictureArgs.Builder setAspectRatio(android.util.Rational);
+    method public android.app.PictureInPictureArgs.Builder setSourceRectHint(android.graphics.Rect);
+  }
+
   public final class RecoverableSecurityException extends java.lang.SecurityException implements android.os.Parcelable {
     method public deprecated void showAsNotification(android.content.Context);
   }
@@ -76,6 +126,10 @@
     method public abstract boolean setInstantAppCookie(byte[]);
   }
 
+  public class ResolveInfo implements android.os.Parcelable {
+    field public deprecated boolean instantAppAvailable;
+  }
+
   public final class SharedLibraryInfo implements android.os.Parcelable {
     method public boolean isBuiltin();
     method public boolean isDynamic();
@@ -188,6 +242,26 @@
     method public deprecated int stopUsingNetworkFeature(int, java.lang.String);
   }
 
+  public deprecated class NetworkBadging {
+    method public static android.graphics.drawable.Drawable getWifiIcon(int, int, android.content.res.Resources.Theme);
+    field public static final int BADGING_4K = 30; // 0x1e
+    field public static final int BADGING_HD = 20; // 0x14
+    field public static final int BADGING_NONE = 0; // 0x0
+    field public static final int BADGING_SD = 10; // 0xa
+  }
+
+  public abstract class NetworkRecommendationProvider {
+    ctor public deprecated NetworkRecommendationProvider(android.os.Handler);
+    method public deprecated void onRequestRecommendation(android.net.RecommendationRequest, android.net.NetworkRecommendationProvider.ResultCallback);
+    field public static final deprecated java.lang.String EXTRA_RECOMMENDATION_RESULT = "android.net.extra.RECOMMENDATION_RESULT";
+    field public static final deprecated java.lang.String EXTRA_SEQUENCE = "android.net.extra.SEQUENCE";
+  }
+
+  public static deprecated class NetworkRecommendationProvider.ResultCallback {
+    ctor public NetworkRecommendationProvider.ResultCallback(android.os.IRemoteCallback, int);
+    method public void onResult(android.net.RecommendationResult);
+  }
+
   public abstract class PskKeyManager {
     ctor public PskKeyManager();
     field public static final int MAX_IDENTITY_HINT_LENGTH_BYTES = 128; // 0x80
@@ -195,6 +269,37 @@
     field public static final int MAX_KEY_LENGTH_BYTES = 256; // 0x100
   }
 
+  public final deprecated class RecommendationRequest implements android.os.Parcelable {
+    ctor protected RecommendationRequest(android.os.Parcel);
+    method public android.net.wifi.WifiConfiguration[] getConnectableConfigs();
+    method public android.net.wifi.WifiConfiguration getConnectedConfig();
+    method public android.net.wifi.WifiConfiguration getDefaultWifiConfig();
+    method public int getLastSelectedNetworkId();
+    method public long getLastSelectedNetworkTimestamp();
+    method public android.net.wifi.ScanResult[] getScanResults();
+    method public void setConnectableConfigs(android.net.wifi.WifiConfiguration[]);
+    method public void setConnectedConfig(android.net.wifi.WifiConfiguration);
+    field public static final android.os.Parcelable.Creator<android.net.RecommendationRequest> CREATOR;
+  }
+
+  public static final deprecated class RecommendationRequest.Builder {
+    ctor public RecommendationRequest.Builder();
+    method public android.net.RecommendationRequest build();
+    method public android.net.RecommendationRequest.Builder setConnectableConfigs(android.net.wifi.WifiConfiguration[]);
+    method public android.net.RecommendationRequest.Builder setConnectedWifiConfig(android.net.wifi.WifiConfiguration);
+    method public android.net.RecommendationRequest.Builder setDefaultWifiConfig(android.net.wifi.WifiConfiguration);
+    method public android.net.RecommendationRequest.Builder setLastSelectedNetwork(int, long);
+    method public android.net.RecommendationRequest.Builder setScanResults(android.net.wifi.ScanResult[]);
+  }
+
+  public final deprecated class RecommendationResult implements android.os.Parcelable {
+    method public static android.net.RecommendationResult createConnectRecommendation(android.net.wifi.WifiConfiguration);
+    method public static android.net.RecommendationResult createDoNotConnectRecommendation();
+    method public android.net.wifi.WifiConfiguration getWifiConfiguration();
+    method public boolean hasRecommendation();
+    field public static final android.os.Parcelable.Creator<android.net.RecommendationResult> CREATOR;
+  }
+
   public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {
     method public static deprecated org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int, android.net.SSLSessionCache);
   }
@@ -221,6 +326,10 @@
     ctor public RecoverySystem();
   }
 
+  public class TestLooperManager {
+    method public deprecated android.os.MessageQueue getQueue();
+  }
+
   public class UserManager {
     method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle, android.graphics.Rect, int);
     method public android.graphics.drawable.Drawable getBadgedIconForUser(android.graphics.drawable.Drawable, android.os.UserHandle);
@@ -382,6 +491,14 @@
 
 }
 
+package android.speech.tts {
+
+  public abstract class UtteranceProgressListener {
+    method public deprecated void onUtteranceRangeStart(java.lang.String, int, int);
+  }
+
+}
+
 package android.test.mock {
 
   public deprecated class MockPackageManager extends android.content.pm.PackageManager {
diff --git a/core/java/android/accessibilityservice/AccessibilityButtonController.java b/core/java/android/accessibilityservice/AccessibilityButtonController.java
index ee19768..a70085c 100644
--- a/core/java/android/accessibilityservice/AccessibilityButtonController.java
+++ b/core/java/android/accessibilityservice/AccessibilityButtonController.java
@@ -19,6 +19,7 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.os.Handler;
+import android.os.Looper;
 import android.os.RemoteException;
 import android.util.ArrayMap;
 import android.util.Slog;
@@ -91,7 +92,7 @@
      * @param callback the callback to add, must be non-null
      */
     public void registerAccessibilityButtonCallback(@NonNull AccessibilityButtonCallback callback) {
-        registerAccessibilityButtonCallback(callback, new Handler());
+        registerAccessibilityButtonCallback(callback, new Handler(Looper.getMainLooper()));
     }
 
     /**
diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
index 70a6ce6..06a9b06 100644
--- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
+++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
@@ -670,9 +670,10 @@
      *    <strong>Statically set from
      *    {@link AccessibilityService#SERVICE_META_DATA meta-data}.</strong>
      * </p>
-     * @return The localized summary.
+     * @return The localized summary if available, and {@code null} if a summary
+     * has not been provided.
      */
-    public String loadSummary(PackageManager packageManager) {
+    public CharSequence loadSummary(PackageManager packageManager) {
         if (mSummaryResId == 0) {
             return mNonLocalizedSummary;
         }
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index ab4f33d..4f6c0c9 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -2050,20 +2050,10 @@
         enterPictureInPictureMode(new PictureInPictureParams.Builder().build());
     }
 
-    /**
-     * TO BE REMOVED
-     */
+    /** @removed */
     @Deprecated
     public boolean enterPictureInPictureMode(@NonNull PictureInPictureArgs args) {
-        try {
-            if (args == null) {
-                throw new IllegalArgumentException("Expected non-null picture-in-picture args");
-            }
-            updatePictureInPictureParamsForContentInsets(args);
-            return ActivityManagerNative.getDefault().enterPictureInPictureMode(mToken, args);
-        } catch (RemoteException e) {
-            return false;
-        }
+        return enterPictureInPictureMode(PictureInPictureArgs.convert(args));
     }
 
     /**
@@ -2095,11 +2085,10 @@
         }
     }
 
-    /**
-     * TO BE REMOVED
-     */
+    /** @removed */
+    @Deprecated
     public void setPictureInPictureArgs(@NonNull PictureInPictureArgs args) {
-        setPictureInPictureParams(args);
+        setPictureInPictureParams(PictureInPictureArgs.convert(args));
     }
 
     /**
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 6bc59fc..9af74ba 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -1127,13 +1127,7 @@
                     com.android.internal.R.bool.config_supportsSplitScreenMultiWindow);
     }
 
-    /**
-     * Return the number of actions that will be displayed in the picture-in-picture UI when the
-     * user interacts with the activity currently in picture-in-picture mode. This number may change
-     * if the global configuration changes (ie. if the device is plugged into an external display).
-     *
-     * TO BE REMOVED
-     */
+    /** @removed */
     @Deprecated
     public static int getMaxNumPictureInPictureActions() {
         return 3;
diff --git a/core/java/android/app/FragmentContainer.java b/core/java/android/app/FragmentContainer.java
index 77c9c31..f8836bc8 100644
--- a/core/java/android/app/FragmentContainer.java
+++ b/core/java/android/app/FragmentContainer.java
@@ -42,6 +42,8 @@
      * Creates an instance of the specified fragment, can be overridden to construct fragments
      * with dependencies, or change the fragment being constructed. By default just calls
      * {@link Fragment#instantiate(Context, String, Bundle)}.
+     *
+     * @hide
      */
     public Fragment instantiate(Context context, String className, Bundle arguments) {
         return Fragment.instantiate(context, className, arguments);
diff --git a/core/java/android/app/KeyguardManager.java b/core/java/android/app/KeyguardManager.java
index 4de6e44..fcf0aab 100644
--- a/core/java/android/app/KeyguardManager.java
+++ b/core/java/android/app/KeyguardManager.java
@@ -362,28 +362,7 @@
         }
     }
 
-    /**
-     * If the device is currently locked (see {@link #isKeyguardLocked()}, requests the Keyguard to
-     * be dismissed.
-     * <p>
-     * If the Keyguard is not secure or the device is currently in a trusted state, calling this
-     * method will immediately dismiss the Keyguard without any user interaction.
-     * <p>
-     * If the Keyguard is secure and the device is not in a trusted state, this will bring up the
-     * UI so the user can enter their credentials.
-     *
-     * @param activity The activity requesting the dismissal. The activity must be either visible
-     *                 by using {@link LayoutParams#FLAG_SHOW_WHEN_LOCKED} or must be in a state in
-     *                 which it would be visible if Keyguard would not be hiding it. If that's not
-     *                 the case, the request will fail immediately and
-     *                 {@link KeyguardDismissCallback#onDismissError} will be invoked.
-     * @param callback The callback to be called if the request to dismiss Keyguard was successful
-     *                 or {@code null} if the caller isn't interested in knowing the result.
-     * @param handler The handler to invoke the callback on, or {@code null} to use the main
-     *                handler.
-     *
-     * TO BE REMOVED
-     */
+    /** @removed */
     @Deprecated
     public void dismissKeyguard(@NonNull Activity activity,
             @Nullable KeyguardDismissCallback callback, @Nullable Handler handler) {
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 28fe319..c8b8c6c 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -2494,9 +2494,8 @@
         }
     }
 
-    /**
-     * Returns the id of the channel this notification posts to.
-     */
+    /** @removed */
+    @Deprecated
     public String getChannel() {
         return mChannelId;
     }
@@ -2508,10 +2507,8 @@
         return mChannelId;
     }
 
-    /**
-     * Returns the time at which this notification should be canceled by the system, if it's not
-     * canceled already.
-     */
+    /** @removed */
+    @Deprecated
     public long getTimeout() {
         return mTimeout;
     }
@@ -2811,9 +2808,8 @@
             return this;
         }
 
-        /**
-         * Specifies the channel the notification should be delivered on.
-         */
+        /** @removed */
+        @Deprecated
         public Builder setChannel(String channelId) {
             mN.mChannelId = channelId;
             return this;
@@ -2827,10 +2823,8 @@
             return this;
         }
 
-        /**
-         * Specifies a duration in milliseconds after which this notification should be canceled,
-         * if it is not already canceled.
-         */
+        /** @removed */
+        @Deprecated
         public Builder setTimeout(long durationMs) {
             mN.mTimeout = durationMs;
             return this;
@@ -8040,9 +8034,8 @@
             return this;
         }
 
-        /**
-         * Returns the id of the channel this notification posts to on TV.
-         */
+        /** @removed */
+        @Deprecated
         public String getChannel() {
             return mChannelId;
         }
diff --git a/core/java/android/app/PictureInPictureArgs.java b/core/java/android/app/PictureInPictureArgs.java
index 63db86a..88e6b99 100644
--- a/core/java/android/app/PictureInPictureArgs.java
+++ b/core/java/android/app/PictureInPictureArgs.java
@@ -16,91 +16,314 @@
 
 package android.app;
 
+import android.annotation.Nullable;
 import android.graphics.Rect;
+import android.os.Parcel;
+import android.os.Parcelable;
 import android.util.Rational;
 
 import java.util.ArrayList;
 import java.util.List;
 
-/**
- * TO BE REMOVED
- */
+/** @removed */
 @Deprecated
-public final class PictureInPictureArgs extends PictureInPictureParams {
+public final class PictureInPictureArgs implements Parcelable {
 
     /**
-     * Creates a new set of picture-in-picture arguments.
-     *
-     * TODO: Remove once we remove PictureInPictureArgs.
+     * Builder class for {@link PictureInPictureArgs} objects.
      */
-    @Deprecated
-    public PictureInPictureArgs() {
-        // Empty constructor
-    }
+    public static class Builder {
 
-    /**
-     * Creates a new set of picture-in-picture arguments from the given {@param aspectRatio} and
-     * {@param actions}.
-     *
-     * TODO: Remove once we remove PictureInPictureArgs.
-     */
-    @Deprecated
-    public PictureInPictureArgs(float aspectRatio, List<RemoteAction> actions) {
-        setAspectRatio(aspectRatio);
-        if (actions != null) {
-            setActions(actions);
+        @Nullable
+        private Rational mAspectRatio;
+
+        @Nullable
+        private List<RemoteAction> mUserActions;
+
+        @Nullable
+        private Rect mSourceRectHint;
+
+        /**
+         * Sets the aspect ratio.  This aspect ratio is defined as the desired width / height, and
+         * does not change upon device rotation.
+         *
+         * @param aspectRatio the new aspect ratio for the activity in picture-in-picture, must be
+         * between 2.39:1 and 1:2.39 (inclusive).
+         *
+         * @return this builder instance.
+         */
+        public Builder setAspectRatio(Rational aspectRatio) {
+            mAspectRatio = aspectRatio;
+            return this;
+        }
+
+        /**
+         * Sets the user actions.  If there are more than
+         * {@link Activity#getMaxNumPictureInPictureActions()} actions, then the input list
+         * will be truncated to that number.
+         *
+         * @param actions the new actions to show in the picture-in-picture menu.
+         *
+         * @return this builder instance.
+         *
+         * @see RemoteAction
+         */
+        public Builder setActions(List<RemoteAction> actions) {
+            if (mUserActions != null) {
+                mUserActions = null;
+            }
+            if (actions != null) {
+                mUserActions = new ArrayList<>(actions);
+            }
+            return this;
+        }
+
+        /**
+         * Sets the source bounds hint. These bounds are only used when an activity first enters
+         * picture-in-picture, and describe the bounds in window coordinates of activity entering
+         * picture-in-picture that will be visible following the transition. For the best effect,
+         * these bounds should also match the aspect ratio in the arguments.
+         *
+         * @param launchBounds window-coordinate bounds indicating the area of the activity that
+         * will still be visible following the transition into picture-in-picture (eg. the video
+         * view bounds in a video player)
+         *
+         * @return this builder instance.
+         */
+        public Builder setSourceRectHint(Rect launchBounds) {
+            if (launchBounds == null) {
+                mSourceRectHint = null;
+            } else {
+                mSourceRectHint = new Rect(launchBounds);
+            }
+            return this;
+        }
+
+        public PictureInPictureArgs build() {
+            PictureInPictureArgs args = new PictureInPictureArgs(mAspectRatio, mUserActions,
+                    mSourceRectHint);
+            return args;
         }
     }
 
     /**
-     * Sets the aspect ratio.
-     *
-     * @param aspectRatio the new aspect ratio for picture-in-picture, must be within 2.39:1 and
-     *                    1:2.39.
-     *
-     * TODO: Remove once we remove PictureInPictureArgs.
+     * The expected aspect ratio of the picture-in-picture.
      */
-    @Deprecated
-    public void setAspectRatio(float aspectRatio) {
-        // Temporary workaround
-        mAspectRatio = new Rational((int) (aspectRatio * 1000000000), 1000000000);
+    @Nullable
+    private Rational mAspectRatio;
+
+    /**
+     * The set of actions that are associated with this activity when in picture-in-picture.
+     */
+    @Nullable
+    private List<RemoteAction> mUserActions;
+
+    /**
+     * The source bounds hint used when entering picture-in-picture, relative to the window bounds.
+     * We can use this internally for the transition into picture-in-picture to ensure that a
+     * particular source rect is visible throughout the whole transition.
+     */
+    @Nullable
+    private Rect mSourceRectHint;
+
+    /**
+     * The content insets that are used with the source hint rect for the transition into PiP where
+     * the insets are removed at the beginning of the transition.
+     */
+    @Nullable
+    private Rect mSourceRectHintInsets;
+
+    private PictureInPictureArgs() {
+    }
+
+    private PictureInPictureArgs(Parcel in) {
+        if (in.readInt() != 0) {
+            mAspectRatio = new Rational(in.readInt(), in.readInt());
+        }
+        if (in.readInt() != 0) {
+            mUserActions = new ArrayList<>();
+            in.readParcelableList(mUserActions, RemoteAction.class.getClassLoader());
+        }
+        if (in.readInt() != 0) {
+            mSourceRectHint = Rect.CREATOR.createFromParcel(in);
+        }
+        if (in.readInt() != 0) {
+            mSourceRectHintInsets = Rect.CREATOR.createFromParcel(in);
+        }
+    }
+
+    private PictureInPictureArgs(Rational aspectRatio, List<RemoteAction> actions,
+            Rect sourceRectHint) {
+        mAspectRatio = aspectRatio;
+        mUserActions = actions;
+        mSourceRectHint = sourceRectHint;
     }
 
     /**
-     * Sets the user actions.  If there are more than
-     * {@link ActivityManager#getMaxNumPictureInPictureActions()} actions, then the input will be
-     * truncated to that number.
-     *
-     * @param actions the new actions to show in the picture-in-picture menu.
-     *
-     * @see RemoteAction
-     *
-     * TODO: Remove once we remove PictureInPictureArgs.
+     * Copies the set parameters from the other picture-in-picture args.
+     * @hide
      */
-    @Deprecated
-    public void setActions(List<RemoteAction> actions) {
-        if (mUserActions != null) {
-            mUserActions = null;
+    public void copyOnlySet(PictureInPictureArgs otherArgs) {
+        if (otherArgs.hasSetAspectRatio()) {
+            mAspectRatio = otherArgs.mAspectRatio;
         }
-        if (actions != null) {
-            mUserActions = new ArrayList<>(actions);
+        if (otherArgs.hasSetActions()) {
+            mUserActions = otherArgs.mUserActions;
+        }
+        if (otherArgs.hasSourceBoundsHint()) {
+            mSourceRectHint = new Rect(otherArgs.getSourceRectHint());
+        }
+        if (otherArgs.hasSourceBoundsHintInsets()) {
+            mSourceRectHintInsets = new Rect(otherArgs.getSourceRectHintInsets());
         }
     }
 
     /**
-     * Sets the source bounds hint. These bounds are only used when an activity first enters
-     * picture-in-picture, and describe the bounds in window coordinates of activity entering
-     * picture-in-picture that will be visible following the transition. For the best effect, these
-     * bounds should also match the aspect ratio in the arguments.
-     *
-     * TODO: Remove once we remove PictureInPictureArgs.
+     * @return the aspect ratio. If none is set, return 0.
+     * @hide
+     */
+    public float getAspectRatio() {
+        if (mAspectRatio != null) {
+            return mAspectRatio.floatValue();
+        }
+        return 0f;
+    }
+
+    /** {@hide} */
+    public Rational getAspectRatioRational() {
+        return mAspectRatio;
+    }
+
+    /**
+     * @return whether the aspect ratio is set.
+     * @hide
+     */
+    public boolean hasSetAspectRatio() {
+        return mAspectRatio != null;
+    }
+
+    /**
+     * @return the set of user actions.
+     * @hide
+     */
+    public List<RemoteAction> getActions() {
+        return mUserActions;
+    }
+
+    /**
+     * @return whether the user actions are set.
+     * @hide
+     */
+    public boolean hasSetActions() {
+        return mUserActions != null;
+    }
+
+    /**
+     * Truncates the set of actions to the given {@param size}.
+     * @hide
+     */
+    public void truncateActions(int size) {
+        if (hasSetActions()) {
+            mUserActions = mUserActions.subList(0, Math.min(mUserActions.size(), size));
+        }
+    }
+
+    /**
+     * Sets the insets to be used with the source rect hint bounds.
+     * @hide
      */
     @Deprecated
-    public void setSourceRectHint(Rect launchBounds) {
-        if (launchBounds == null) {
-            mSourceRectHint = null;
+    public void setSourceRectHintInsets(Rect insets) {
+        if (insets == null) {
+            mSourceRectHintInsets = null;
         } else {
-            mSourceRectHint = new Rect(launchBounds);
+            mSourceRectHintInsets = new Rect(insets);
         }
     }
-}
\ No newline at end of file
+
+    /**
+     * @return the source rect hint
+     * @hide
+     */
+    public Rect getSourceRectHint() {
+        return mSourceRectHint;
+    }
+
+    /**
+     * @return the source rect hint insets.
+     * @hide
+     */
+    public Rect getSourceRectHintInsets() {
+        return mSourceRectHintInsets;
+    }
+
+    /**
+     * @return whether there are launch bounds set
+     * @hide
+     */
+    public boolean hasSourceBoundsHint() {
+        return mSourceRectHint != null && !mSourceRectHint.isEmpty();
+    }
+
+    /**
+     * @return whether there are source rect hint insets set
+     * @hide
+     */
+    public boolean hasSourceBoundsHintInsets() {
+        return mSourceRectHintInsets != null;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel out, int flags) {
+        if (mAspectRatio != null) {
+            out.writeInt(1);
+            out.writeInt(mAspectRatio.getNumerator());
+            out.writeInt(mAspectRatio.getDenominator());
+        } else {
+            out.writeInt(0);
+        }
+        if (mUserActions != null) {
+            out.writeInt(1);
+            out.writeParcelableList(mUserActions, 0);
+        } else {
+            out.writeInt(0);
+        }
+        if (mSourceRectHint != null) {
+            out.writeInt(1);
+            mSourceRectHint.writeToParcel(out, 0);
+        } else {
+            out.writeInt(0);
+        }
+        if (mSourceRectHintInsets != null) {
+            out.writeInt(1);
+            mSourceRectHintInsets.writeToParcel(out, 0);
+        } else {
+            out.writeInt(0);
+        }
+    }
+
+    public static final Creator<PictureInPictureArgs> CREATOR =
+            new Creator<PictureInPictureArgs>() {
+                public PictureInPictureArgs createFromParcel(Parcel in) {
+                    return new PictureInPictureArgs(in);
+                }
+                public PictureInPictureArgs[] newArray(int size) {
+                    return new PictureInPictureArgs[size];
+                }
+            };
+
+    public static PictureInPictureArgs convert(PictureInPictureParams params) {
+        return new PictureInPictureArgs(params.getAspectRatioRational(), params.getActions(),
+                params.getSourceRectHint());
+    }
+
+    public static PictureInPictureParams convert(PictureInPictureArgs args) {
+        return new PictureInPictureParams(args.getAspectRatioRational(), args.getActions(),
+                args.getSourceRectHint());
+    }
+}
diff --git a/core/java/android/app/PictureInPictureParams.java b/core/java/android/app/PictureInPictureParams.java
index e1df33b..323a0fb 100644
--- a/core/java/android/app/PictureInPictureParams.java
+++ b/core/java/android/app/PictureInPictureParams.java
@@ -28,10 +28,8 @@
 /**
  * Represents a set of parameters used to initialize and update an Activity in picture-in-picture
  * mode.
- *
- * TODO: Make this final after we remove PictureInPictureArgs
  */
-public class PictureInPictureParams implements Parcelable {
+public final class PictureInPictureParams implements Parcelable {
 
     /**
      * Builder class for {@link PictureInPictureParams} objects.
@@ -63,7 +61,7 @@
 
         /**
          * Sets the user actions.  If there are more than
-         * {@link ActivityManager#getMaxNumPictureInPictureActions()} actions, then the input list
+         * {@link Activity#getMaxNumPictureInPictureActions()} actions, then the input list
          * will be truncated to that number.
          *
          * @param actions the new actions to show in the picture-in-picture menu.
@@ -120,25 +118,22 @@
     /**
      * The expected aspect ratio of the picture-in-picture.
      */
-    // TODO: Make private once we removed PictureInPictureArgs
     @Nullable
-    protected Rational mAspectRatio;
+    private Rational mAspectRatio;
 
     /**
      * The set of actions that are associated with this activity when in picture-in-picture.
      */
-    // TODO: Make private once we removed PictureInPictureArgs
     @Nullable
-    protected List<RemoteAction> mUserActions;
+    private List<RemoteAction> mUserActions;
 
     /**
      * The source bounds hint used when entering picture-in-picture, relative to the window bounds.
      * We can use this internally for the transition into picture-in-picture to ensure that a
      * particular source rect is visible throughout the whole transition.
      */
-    // TODO: Make private once we removed PictureInPictureArgs
     @Nullable
-    protected Rect mSourceRectHint;
+    private Rect mSourceRectHint;
 
     /**
      * The content insets that are used with the source hint rect for the transition into PiP where
@@ -147,15 +142,12 @@
     @Nullable
     private Rect mSourceRectHintInsets;
 
-    /**
-     * TO BE REMOVED
-     */
-    @Deprecated
+    /** {@hide} */
     PictureInPictureParams() {
-        // TODO: Remove once we remove PictureInPictureArgs
     }
 
-    private PictureInPictureParams(Parcel in) {
+    /** {@hide} */
+    PictureInPictureParams(Parcel in) {
         if (in.readInt() != 0) {
             mAspectRatio = new Rational(in.readInt(), in.readInt());
         }
@@ -171,7 +163,8 @@
         }
     }
 
-    private PictureInPictureParams(Rational aspectRatio, List<RemoteAction> actions,
+    /** {@hide} */
+    PictureInPictureParams(Rational aspectRatio, List<RemoteAction> actions,
             Rect sourceRectHint) {
         mAspectRatio = aspectRatio;
         mUserActions = actions;
@@ -208,6 +201,11 @@
         return 0f;
     }
 
+    /** @hide */
+    public Rational getAspectRatioRational() {
+        return mAspectRatio;
+    }
+
     /**
      * @return whether the aspect ratio is set.
      * @hide
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index e013662..1d879e9 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1710,19 +1710,6 @@
     public static final String ACTION_UNINSTALL_PACKAGE = "android.intent.action.UNINSTALL_PACKAGE";
 
     /**
-     * Activity Action: Launch application uninstaller.
-     * <p>
-     * Input: The data must be a package: URI whose scheme specific part is
-     * the package name of the current installed package to be uninstalled.
-     * You can optionally supply {@link #EXTRA_RETURN_RESULT}.
-     * <p>
-     * Output: Nothing.
-     * </p>
-     */
-    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
-    public static final String ACTION_CLEAR_PACKAGE = "android.intent.action.CLEAR_PACKAGE";
-
-    /**
      * Specify whether the package should be uninstalled for all users.
      * @hide because these should not be part of normal application flow.
      */
@@ -3398,32 +3385,6 @@
             ACTION_DYNAMIC_SENSOR_CHANGED = "android.intent.action.DYNAMIC_SENSOR_CHANGED";
 
     /**
-     * Broadcast Action: The default subscription has changed.  This has the following
-     * extra values:</p>
-     * The {@link #EXTRA_SUBSCRIPTION_INDEX} extra indicates the current default subscription index
-     */
-    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
-    public static final String ACTION_DEFAULT_SUBSCRIPTION_CHANGED
-            = "android.intent.action.ACTION_DEFAULT_SUBSCRIPTION_CHANGED";
-
-    /**
-     * Broadcast Action: The default sms subscription has changed.  This has the following
-     * extra values:</p>
-     * {@link #EXTRA_SUBSCRIPTION_INDEX} extra indicates the current default sms
-     * subscription index
-     */
-    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
-    public static final String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED
-            = "android.intent.action.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED";
-
-    /**
-     * Integer extra used with {@link #ACTION_DEFAULT_SUBSCRIPTION_CHANGED} and
-     * {@link #ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED} to indicate the subscription
-     * which has changed.
-     */
-    public static final String EXTRA_SUBSCRIPTION_INDEX = "android.intent.extra.SUBSCRIPTION_INDEX";
-
-    /**
      * Deprecated - use ACTION_FACTORY_RESET instead.
      * @hide
      */
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 0be0885..cf7f017 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -883,9 +883,12 @@
     /**
      * Screen rotation animation desired by the activity, with values as defined
      * for {@link android.view.WindowManager.LayoutParams#rotationAnimation}.
+     *
+     * -1 means to use the system default.
+     *
      * @hide
      */
-    public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
+    public int rotationAnimation = -1;
 
     /** @hide */
     public static final int LOCK_TASK_LAUNCH_MODE_DEFAULT = 0;
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 1013177..9b0bab4 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -201,10 +201,10 @@
     private static final String META_DATA_INSTANT_APPS = "instantapps.clients.allowed";
 
     /**
-     * Bit mask of all the valid bits that can be set in restartOnConfigChanges.
+     * Bit mask of all the valid bits that can be set in recreateOnConfigChanges.
      * @hide
      */
-    private static final int RESTART_ON_CONFIG_CHANGES_MASK =
+    private static final int RECREATE_ON_CONFIG_CHANGES_MASK =
             ActivityInfo.CONFIG_MCC | ActivityInfo.CONFIG_MNC;
 
     // These are the tags supported by child packages
@@ -4219,7 +4219,7 @@
                     ActivityManager.getDefaultAppRecentsLimitStatic());
             a.info.configChanges = getActivityConfigChanges(
                     sa.getInt(R.styleable.AndroidManifestActivity_configChanges, 0),
-                    sa.getInt(R.styleable.AndroidManifestActivity_restartOnConfigChanges, 0));
+                    sa.getInt(R.styleable.AndroidManifestActivity_recreateOnConfigChanges, 0));
             a.info.softInputMode = sa.getInt(
                     R.styleable.AndroidManifestActivity_windowSoftInputMode, 0);
 
@@ -4523,13 +4523,13 @@
 
     /**
      * @param configChanges The bit mask of configChanges fetched from AndroidManifest.xml.
-     * @param restartOnConfigChanges The bit mask restartOnConfigChanges fetched from
-     *                               AndroidManifest.xml.
+     * @param recreateOnConfigChanges The bit mask recreateOnConfigChanges fetched from
+     *                                AndroidManifest.xml.
      * @hide Exposed for unit testing only.
      */
     @TestApi
-    public static int getActivityConfigChanges(int configChanges, int restartOnConfigChanges) {
-        return configChanges | ((~restartOnConfigChanges) & RESTART_ON_CONFIG_CHANGES_MASK);
+    public static int getActivityConfigChanges(int configChanges, int recreateOnConfigChanges) {
+        return configChanges | ((~recreateOnConfigChanges) & RECREATE_ON_CONFIG_CHANGES_MASK);
     }
 
     private void parseLayout(Resources res, AttributeSet attrs, Activity a) {
diff --git a/core/java/android/content/pm/ResolveInfo.java b/core/java/android/content/pm/ResolveInfo.java
index 650b4c0..f312204 100644
--- a/core/java/android/content/pm/ResolveInfo.java
+++ b/core/java/android/content/pm/ResolveInfo.java
@@ -71,6 +71,10 @@
     /**
      * Whether or not an instant app is available for the resolved intent.
      */
+    public boolean isInstantAppAvailable;
+
+    /** @removed */
+    @Deprecated
     public boolean instantAppAvailable;
 
     /**
@@ -330,7 +334,8 @@
         system = orig.system;
         targetUserId = orig.targetUserId;
         handleAllWebDataURI = orig.handleAllWebDataURI;
-        instantAppAvailable = orig.instantAppAvailable;
+        isInstantAppAvailable = orig.isInstantAppAvailable;
+        instantAppAvailable = isInstantAppAvailable;
     }
 
     public String toString() {
@@ -394,7 +399,7 @@
         dest.writeInt(noResourceId ? 1 : 0);
         dest.writeInt(iconResourceId);
         dest.writeInt(handleAllWebDataURI ? 1 : 0);
-        dest.writeInt(instantAppAvailable ? 1 : 0);
+        dest.writeInt(isInstantAppAvailable ? 1 : 0);
     }
 
     public static final Creator<ResolveInfo> CREATOR
@@ -442,7 +447,7 @@
         noResourceId = source.readInt() != 0;
         iconResourceId = source.readInt();
         handleAllWebDataURI = source.readInt() != 0;
-        instantAppAvailable = source.readInt() != 0;
+        instantAppAvailable = isInstantAppAvailable = source.readInt() != 0;
     }
 
     public static class DisplayNameComparator
diff --git a/core/java/android/content/pm/SharedLibraryInfo.java b/core/java/android/content/pm/SharedLibraryInfo.java
index 0ad4874..5032e6a 100644
--- a/core/java/android/content/pm/SharedLibraryInfo.java
+++ b/core/java/android/content/pm/SharedLibraryInfo.java
@@ -131,7 +131,7 @@
      *
      * @return The version.
      */
-    public @IntRange(from = -1) long getVersion() {
+    public @IntRange(from = -1) int getVersion() {
         return mVersion;
     }
 
diff --git a/core/java/android/net/NetworkBadging.java b/core/java/android/net/NetworkBadging.java
index b4ef695..6de28b7 100644
--- a/core/java/android/net/NetworkBadging.java
+++ b/core/java/android/net/NetworkBadging.java
@@ -35,9 +35,10 @@
 /**
  * Utility methods for working with network badging.
  *
- * @hide
+ * @removed
+ *
  */
-@SystemApi
+@Deprecated
 public class NetworkBadging {
 
     @IntDef({BADGING_NONE, BADGING_SD, BADGING_HD, BADGING_4K})
diff --git a/core/java/android/net/NetworkRecommendationProvider.java b/core/java/android/net/NetworkRecommendationProvider.java
index 1eaa1f9..a6d132e 100644
--- a/core/java/android/net/NetworkRecommendationProvider.java
+++ b/core/java/android/net/NetworkRecommendationProvider.java
@@ -41,11 +41,13 @@
     private static final boolean VERBOSE = Build.IS_DEBUGGABLE && Log.isLoggable(TAG, Log.VERBOSE);
     /** The key into the callback Bundle where the RecommendationResult will be found.
      * @deprecated to be removed.
+     * @removed
      */
     public static final String EXTRA_RECOMMENDATION_RESULT =
             "android.net.extra.RECOMMENDATION_RESULT";
     /** The key into the callback Bundle where the sequence will be found.
      * @deprecated to be removed.
+     * @removed
      */
     public static final String EXTRA_SEQUENCE = "android.net.extra.SEQUENCE";
     private final IBinder mService;
@@ -54,6 +56,7 @@
      * Constructs a new instance.
      * @param handler indicates which thread to use when handling requests. Cannot be {@code null}.
      * @deprecated use {@link #NetworkRecommendationProvider(Context, Executor)}
+     * @removed
      */
     public NetworkRecommendationProvider(Handler handler) {
         if (handler == null) {
@@ -82,6 +85,7 @@
      *                 available it must be passed into
      *                 {@link ResultCallback#onResult(RecommendationResult)}.
      * @deprecated to be removed.
+     * @removed
      */
     public void onRequestRecommendation(RecommendationRequest request, ResultCallback callback) {}
 
@@ -107,6 +111,7 @@
      * is available.
      *
      * @deprecated to be removed.
+     * @removed
      */
     public static class ResultCallback {
         private final IRemoteCallback mCallback;
diff --git a/core/java/android/net/RecommendationRequest.java b/core/java/android/net/RecommendationRequest.java
index 45ee3a5..21641d9 100644
--- a/core/java/android/net/RecommendationRequest.java
+++ b/core/java/android/net/RecommendationRequest.java
@@ -17,7 +17,6 @@
 package android.net;
 
 
-import android.annotation.SystemApi;
 import android.net.wifi.ScanResult;
 import android.net.wifi.WifiConfiguration;
 import android.os.Parcel;
@@ -31,8 +30,8 @@
  * @see {@link NetworkScoreManager#requestRecommendation(RecommendationRequest)}.
  * @hide
  * @deprecated to be removed.
+ * @removed
  */
-@SystemApi
 public final class RecommendationRequest implements Parcelable {
     private final ScanResult[] mScanResults;
     private final WifiConfiguration mDefaultConfig;
@@ -45,8 +44,8 @@
      * Builder class for constructing {@link RecommendationRequest} instances.
      * @hide
      * @deprecated to be removed.
+     * @removed
      */
-    @SystemApi
     public static final class Builder {
         private ScanResult[] mScanResults;
         private WifiConfiguration mDefaultConfig;
diff --git a/core/java/android/net/RecommendationResult.java b/core/java/android/net/RecommendationResult.java
index ce4d83a..d66dd22 100644
--- a/core/java/android/net/RecommendationResult.java
+++ b/core/java/android/net/RecommendationResult.java
@@ -18,12 +18,10 @@
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
-import android.annotation.SystemApi;
 import android.net.wifi.WifiConfiguration;
 import android.os.Parcel;
 import android.os.Parcelable;
 
-import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.util.Preconditions;
 
 /**
@@ -32,8 +30,8 @@
  * @see {@link NetworkScoreManager#requestRecommendation(RecommendationRequest)}.
  * @hide
  * @deprecated to be removed.
+ * @removed
  */
-@SystemApi
 public final class RecommendationResult implements Parcelable {
     private final WifiConfiguration mWifiConfiguration;
 
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index b715780..037cccf 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -55,6 +55,7 @@
     void rebootSafeMode(boolean confirm, boolean wait);
     void shutdown(boolean confirm, String reason, boolean wait);
     void crash(String message);
+    int getLastShutdownReason();
 
     void setStayOnSetting(int val);
     void boostScreenBrightness(long time);
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index a713eef..7d1369f 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -16,10 +16,13 @@
 
 package android.os;
 
+import android.annotation.IntDef;
 import android.annotation.SdkConstant;
 import android.annotation.SystemApi;
 import android.content.Context;
 import android.util.Log;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
 
 /**
  * This class gives you control of the power state of the device.
@@ -432,6 +435,49 @@
      */
     public static final String SHUTDOWN_USER_REQUESTED = "userrequested";
 
+    /**
+     * @hide
+     */
+    @Retention(RetentionPolicy.SOURCE)
+    @IntDef({
+            SHUTDOWN_REASON_UNKNOWN,
+            SHUTDOWN_REASON_SHUTDOWN,
+            SHUTDOWN_REASON_REBOOT,
+            SHUTDOWN_REASON_USER_REQUESTED,
+            SHUTDOWN_REASON_THERMAL_SHUTDOWN
+    })
+    public @interface ShutdownReason {}
+
+    /**
+     * constant for shutdown reason being unknown.
+     * @hide
+     */
+    public static final int SHUTDOWN_REASON_UNKNOWN = 0;
+
+    /**
+     * constant for shutdown reason being normal shutdown.
+     * @hide
+     */
+    public static final int SHUTDOWN_REASON_SHUTDOWN = 1;
+
+    /**
+     * constant for shutdown reason being reboot.
+     * @hide
+     */
+    public static final int SHUTDOWN_REASON_REBOOT = 2;
+
+    /**
+     * constant for shutdown reason being user requested.
+     * @hide
+     */
+    public static final int SHUTDOWN_REASON_USER_REQUESTED = 3;
+
+    /**
+     * constant for shutdown reason being overheating.
+     * @hide
+     */
+    public static final int SHUTDOWN_REASON_THERMAL_SHUTDOWN = 4;
+
     final Context mContext;
     final IPowerManager mService;
     final Handler mHandler;
@@ -1085,6 +1131,22 @@
     }
 
     /**
+     * Returns the reason the phone was last shutdown. Calling app must have the
+     * {@link android.Manifest.permission#DEVICE_POWER} permission to request this information.
+     * @return Reason for shutdown as an int, {@link #SHUTDOWN_REASON_UNKNOWN} if the file could
+     * not be accessed.
+     * @hide
+     */
+    @ShutdownReason
+    public int getLastShutdownReason() {
+        try {
+            return mService.getLastShutdownReason();
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    /**
      * Intent that is broadcast when the state of {@link #isPowerSaveMode()} changes.
      * This broadcast is only sent to registered receivers.
      */
diff --git a/core/java/android/os/TestLooperManager.java b/core/java/android/os/TestLooperManager.java
index 745642e..5e7549f 100644
--- a/core/java/android/os/TestLooperManager.java
+++ b/core/java/android/os/TestLooperManager.java
@@ -58,11 +58,17 @@
     /**
      * Returns the {@link MessageQueue} this object is wrapping.
      */
-    public MessageQueue getQueue() {
+    public MessageQueue getMessageQueue() {
         checkReleased();
         return mQueue;
     }
 
+    /** @removed */
+    @Deprecated
+    public MessageQueue getQueue() {
+        return getMessageQueue();
+    }
+
     /**
      * Returns the next message that should be executed by this queue, may block
      * if no messages are ready.
diff --git a/core/java/android/os/VintfRuntimeInfo.java b/core/java/android/os/VintfRuntimeInfo.java
new file mode 100644
index 0000000..29698b9
--- /dev/null
+++ b/core/java/android/os/VintfRuntimeInfo.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2017 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.os;
+
+/**
+ * Java API for ::android::vintf::RuntimeInfo. Methods return null / 0 on any error.
+ *
+ * @hide
+ */
+public class VintfRuntimeInfo {
+
+    private VintfRuntimeInfo() {}
+
+    /**
+     * @return /sys/fs/selinux/policyvers, via security_policyvers() native call
+     */
+    public static native long getKernelSepolicyVersion();
+    /**
+     * @return content of /proc/cpuinfo
+     */
+    public static native String getCpuInfo();
+    /**
+     * @return os name extracted from uname() native call
+     */
+    public static native String getOsName();
+    /**
+     * @return node name extracted from uname() native call
+     */
+    public static native String getNodeName();
+    /**
+     * @return os release extracted from uname() native call
+     */
+    public static native String getOsRelease();
+    /**
+     * @return os version extracted from uname() native call
+     */
+    public static native String getOsVersion();
+    /**
+     * @return hardware id extracted from uname() native call
+     */
+    public static native String getHardwareId();
+    /**
+     * @return kernel version extracted from uname() native call. Format is
+     * {@code x.y.z}.
+     */
+    public static native String getKernelVersion();
+    /**
+     * @return libavb version in OS. Format is {@code x.y}.
+     */
+    public static native String getBootAvbVersion();
+    /**
+     * @return libavb version in bootloader. Format is {@code x.y}.
+     */
+    public static native String getBootVbmetaAvbVersion();
+
+}
diff --git a/core/java/android/service/autofill/AutofillService.java b/core/java/android/service/autofill/AutofillService.java
index 416455d..88d17ef 100644
--- a/core/java/android/service/autofill/AutofillService.java
+++ b/core/java/android/service/autofill/AutofillService.java
@@ -119,7 +119,7 @@
                 try {
                     onFillRequest(request, cancellation, fillCallback);
                 } catch (AbstractMethodError e) {
-                    final ArrayList<FillContext> contexts = request.getFillContexts();
+                    final List<FillContext> contexts = request.getFillContexts();
                     onFillRequest(contexts.get(contexts.size() - 1).getStructure(),
                             request.getClientState(), request.getFlags(), cancellation,
                             fillCallback);
diff --git a/core/java/android/service/autofill/FillRequest.java b/core/java/android/service/autofill/FillRequest.java
index 8ac399c..b1145ee 100644
--- a/core/java/android/service/autofill/FillRequest.java
+++ b/core/java/android/service/autofill/FillRequest.java
@@ -29,6 +29,7 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * This class represents a request to an {@link AutofillService autofill provider}
@@ -96,7 +97,7 @@
     /**
      * @return The contexts associated with each previous fill request.
      */
-    public @NonNull ArrayList<FillContext> getFillContexts() {
+    public @NonNull List<FillContext> getFillContexts() {
         return mContexts;
     }
 
diff --git a/core/java/android/service/autofill/FillResponse.java b/core/java/android/service/autofill/FillResponse.java
index 42c0151..1914db9 100644
--- a/core/java/android/service/autofill/FillResponse.java
+++ b/core/java/android/service/autofill/FillResponse.java
@@ -30,6 +30,7 @@
 import android.widget.RemoteViews;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 
 /**
  * Response for a {@link
@@ -258,12 +259,17 @@
          * @param ids id of Views that when focused will display the authentication UI affordance.
          *
          * @return This builder.
+         * @throw {@link IllegalArgumentException} if {@code ids} is {@code null} or empty, or if
+         * neither {@code authentication} nor {@code presentation} is non-{@code null}.
+         *
          * @see android.app.PendingIntent#getIntentSender()
          */
         public @NonNull Builder setAuthentication(@NonNull AutofillId[] ids,
                 @Nullable IntentSender authentication, @Nullable RemoteViews presentation) {
             throwIfDestroyed();
-            // TODO(b/37424539): assert ids is not null nor empty once old version is removed
+            if (ids == null || ids.length == 0) {
+                throw new IllegalArgumentException("ids cannot be null or empry");
+            }
             if (authentication == null ^ presentation == null) {
                 throw new IllegalArgumentException("authentication and presentation"
                         + " must be both non-null or null");
@@ -275,17 +281,6 @@
         }
 
         /**
-         * TODO(b/37424539): will be removed once clients use the version that takes ids
-         * @hide
-         * @deprecated
-         */
-        @Deprecated
-        public @NonNull Builder setAuthentication(@Nullable IntentSender authentication,
-                @Nullable RemoteViews presentation) {
-            return setAuthentication(null, authentication, presentation);
-        }
-
-        /**
          * Specifies views that should not trigger new
          * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal,
          * FillCallback)} requests.
@@ -396,6 +391,7 @@
     public String toString() {
         if (!sDebug) return super.toString();
 
+        // TODO: create a dump() method instead
         return new StringBuilder(
                 "FillResponse : [mRequestId=" + mRequestId)
                 .append(", datasets=").append(mDatasets)
@@ -403,10 +399,8 @@
                 .append(", clientState=").append(mClientState != null)
                 .append(", hasPresentation=").append(mPresentation != null)
                 .append(", hasAuthentication=").append(mAuthentication != null)
-                .append(", authenticationSize=").append(mAuthenticationIds != null
-                        ? mAuthenticationIds.length : "N/A")
-                .append(", ignoredIdsSize=").append(mIgnoredIds != null
-                    ? mIgnoredIds.length : "N/A")
+                .append(", authenticationIds=").append(Arrays.toString(mAuthenticationIds))
+                .append(", ignoredIds=").append(Arrays.toString(mIgnoredIds))
                 .append("]")
                 .toString();
     }
@@ -447,8 +441,16 @@
             }
             builder.setSaveInfo(parcel.readParcelable(null));
             builder.setClientState(parcel.readParcelable(null));
-            builder.setAuthentication(parcel.readParcelableArray(null, AutofillId.class),
-                    parcel.readParcelable(null), parcel.readParcelable(null));
+
+            // Sets authentication state.
+            final AutofillId[] authenticationIds = parcel.readParcelableArray(null,
+                    AutofillId.class);
+            final IntentSender authentication = parcel.readParcelable(null);
+            final RemoteViews presentation = parcel.readParcelable(null);
+            if (authenticationIds != null) {
+                builder.setAuthentication(authenticationIds, authentication, presentation);
+            }
+
             builder.setIgnoredIds(parcel.readParcelableArray(null, AutofillId.class));
             final FillResponse response = builder.build();
 
diff --git a/core/java/android/speech/tts/UtteranceProgressListener.java b/core/java/android/speech/tts/UtteranceProgressListener.java
index ef81f12..7381a12 100644
--- a/core/java/android/speech/tts/UtteranceProgressListener.java
+++ b/core/java/android/speech/tts/UtteranceProgressListener.java
@@ -144,9 +144,8 @@
         onUtteranceRangeStart(utteranceId, start, end);
     }
 
-    /**
-     * @deprecated Due to internal API changes. Remove when apps catch up.
-     */
+    /** @removed */
+    @Deprecated
     public void onUtteranceRangeStart(String utteranceId, int start, int end) {
     }
 
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index 0a24bfb0..d0133ed 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -95,7 +95,7 @@
      * Type: {@link android.os.Bundle}
      */
     public static final String EXTRA_CLIENT_STATE =
-            "android.view.autofill.extra.EXTRA_CLIENT_STATE";
+            "android.view.autofill.extra.CLIENT_STATE";
 
     static final String SESSION_ID_TAG = "android:sessionId";
     static final String LAST_AUTOFILLED_DATA_TAG = "android:lastAutoFilledData";
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 1c87726..5476ab2 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -7088,7 +7088,8 @@
             final int size = scrapViews.size();
             if (size > 0) {
                 // See if we still have a view for this position or ID.
-                for (int i = 0; i < size; i++) {
+                // Traverse backwards to find the most recently used scrap view
+                for (int i = size - 1; i >= 0; i--) {
                     final View view = scrapViews.get(i);
                     final AbsListView.LayoutParams params =
                             (AbsListView.LayoutParams) view.getLayoutParams();
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index ceb3cc8..77c72eb 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -97,6 +97,7 @@
     android_os_Trace.cpp \
     android_os_UEventObserver.cpp \
     android_os_VintfObject.cpp \
+    android_os_VintfRuntimeInfo.cpp \
     android_net_LocalSocketImpl.cpp \
     android_net_NetUtils.cpp \
     android_net_TrafficStats.cpp \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 8ca4794..372607d 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -160,6 +160,7 @@
 extern int register_android_os_Parcel(JNIEnv* env);
 extern int register_android_os_SELinux(JNIEnv* env);
 extern int register_android_os_VintfObject(JNIEnv *env);
+extern int register_android_os_VintfRuntimeInfo(JNIEnv *env);
 extern int register_android_os_seccomp(JNIEnv* env);
 extern int register_android_os_SystemProperties(JNIEnv *env);
 extern int register_android_os_SystemClock(JNIEnv* env);
@@ -1304,6 +1305,7 @@
     REG_JNI(register_android_os_HwParcel),
     REG_JNI(register_android_os_HwRemoteBinder),
     REG_JNI(register_android_os_VintfObject),
+    REG_JNI(register_android_os_VintfRuntimeInfo),
     REG_JNI(register_android_nio_utils),
     REG_JNI(register_android_graphics_Canvas),
     REG_JNI(register_android_graphics_Graphics),
diff --git a/core/jni/android_os_VintfRuntimeInfo.cpp b/core/jni/android_os_VintfRuntimeInfo.cpp
new file mode 100644
index 0000000..ecb6854
--- /dev/null
+++ b/core/jni/android_os_VintfRuntimeInfo.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#define LOG_TAG "VintfRuntimeInfo"
+//#define LOG_NDEBUG 0
+
+#include <JNIHelp.h>
+#include <vintf/VintfObject.h>
+#include <vintf/parse_string.h>
+#include <vintf/parse_xml.h>
+
+#include "core_jni_helpers.h"
+
+namespace android {
+
+using vintf::RuntimeInfo;
+using vintf::VintfObject;
+
+#define MAP_STRING_METHOD(javaMethod, cppString)                                       \
+    static jstring android_os_VintfRuntimeInfo_##javaMethod(JNIEnv* env, jclass clazz) \
+    {                                                                                  \
+        const RuntimeInfo *info = VintfObject::GetRuntimeInfo();                       \
+        if (info == nullptr) return nullptr;                                           \
+        return env->NewStringUTF((cppString).c_str());                                 \
+    }                                                                                  \
+
+MAP_STRING_METHOD(getCpuInfo, info->cpuInfo());
+MAP_STRING_METHOD(getOsName, info->osName());
+MAP_STRING_METHOD(getNodeName, info->nodeName());
+MAP_STRING_METHOD(getOsRelease, info->osRelease());
+MAP_STRING_METHOD(getOsVersion, info->osVersion());
+MAP_STRING_METHOD(getHardwareId, info->hardwareId());
+MAP_STRING_METHOD(getKernelVersion, vintf::to_string(info->kernelVersion()));
+MAP_STRING_METHOD(getBootAvbVersion, vintf::to_string(info->bootAvbVersion()));
+MAP_STRING_METHOD(getBootVbmetaAvbVersion, vintf::to_string(info->bootVbmetaAvbVersion()));
+
+
+static jlong android_os_VintfRuntimeInfo_getKernelSepolicyVersion(JNIEnv *env, jclass clazz)
+{
+    const RuntimeInfo *info = VintfObject::GetRuntimeInfo();
+    if (info == nullptr) return 0;
+    return static_cast<jlong>(info->kernelSepolicyVersion());
+}
+
+// ----------------------------------------------------------------------------
+
+static const JNINativeMethod gVintfRuntimeInfoMethods[] = {
+    {"getKernelSepolicyVersion", "()J", (void*)android_os_VintfRuntimeInfo_getKernelSepolicyVersion},
+    {"getCpuInfo", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getCpuInfo},
+    {"getOsName", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getOsName},
+    {"getNodeName", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getNodeName},
+    {"getOsRelease", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getOsRelease},
+    {"getOsVersion", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getOsVersion},
+    {"getHardwareId", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getHardwareId},
+    {"getKernelVersion", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getKernelVersion},
+    {"getBootAvbVersion", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getBootAvbVersion},
+    {"getBootVbmetaAvbVersion", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getBootVbmetaAvbVersion},
+};
+
+const char* const kVintfRuntimeInfoPathName = "android/os/VintfRuntimeInfo";
+
+int register_android_os_VintfRuntimeInfo(JNIEnv* env)
+{
+    return RegisterMethodsOrDie(env, kVintfRuntimeInfoPathName, gVintfRuntimeInfoMethods, NELEM(gVintfRuntimeInfoMethods));
+}
+
+};
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 4b39646..f418435 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -376,8 +376,6 @@
     <protected-broadcast android:name="android.nfc.handover.intent.action.TRANSFER_PROGRESS" />
     <protected-broadcast android:name="android.nfc.handover.intent.action.TRANSFER_DONE" />
 
-    <protected-broadcast android:name="android.intent.action.ACTION_DEFAULT_SUBSCRIPTION_CHANGED" />
-    <protected-broadcast android:name="android.intent.action.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED" />
     <protected-broadcast android:name="android.intent.action.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED" />
     <protected-broadcast android:name="android.intent.action.ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED" />
     <protected-broadcast android:name="android.intent.action.ACTION_SUBINFO_CONTENT_CHANGE" />
@@ -445,6 +443,8 @@
     <protected-broadcast android:name="android.telecom.action.PHONE_ACCOUNT_UNREGISTERED" />
     <protected-broadcast android:name="android.telecom.action.SHOW_MISSED_CALLS_NOTIFICATION" />
     <protected-broadcast android:name="android.telephony.action.CARRIER_CONFIG_CHANGED" />
+    <protected-broadcast android:name="android.telephony.action.DEFAULT_SUBSCRIPTION_CHANGED" />
+    <protected-broadcast android:name="android.telephony.action.DEFAULT_SMS_SUBSCRIPTION_CHANGED" />
     <protected-broadcast android:name="android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION" />
 
     <protected-broadcast android:name="com.android.bluetooth.btservice.action.ALARM_WAKEUP" />
@@ -826,16 +826,6 @@
         android:description="@string/permdesc_callPhone"
         android:protectionLevel="dangerous" />
 
-    <!-- Allows an application to manage its own calls, but rely on the system to route focus to the
-         currently active call.
-        <p>Protection level: dangerous
-    -->
-    <permission android:name="android.permission.MANAGE_OWN_CALLS"
-        android:permissionGroup="android.permission-group.PHONE"
-        android:label="@string/permlab_manageOwnCalls"
-        android:description="@string/permdesc_manageOwnCalls"
-        android:protectionLevel="dangerous" />
-
     <!-- Allows an application to access the IMS call service: making and
          modifying a call
         <p>Protection level: signature|privileged
@@ -923,6 +913,16 @@
         android:description="@string/permdesc_answerPhoneCalls"
         android:protectionLevel="dangerous|runtime" />
 
+    <!-- Allows a calling application which manages it own calls through the self-managed
+         {@link android.telecom.ConnectionService} APIs.  See
+         {@link android.telecom.PhoneAccount#CAPABILITY_SELF_MANAGED for more information on the
+         self-managed ConnectionService APIs.
+         <p>Protection level: normal
+    -->
+    <permission android:name="android.permission.MANAGE_OWN_CALLS"
+                android:label="@string/permlab_manageOwnCalls"
+                android:description="@string/permdesc_manageOwnCalls"
+                android:protectionLevel="normal" />
 
     <!-- ====================================================================== -->
     <!-- Permissions for accessing the device microphone                        -->
@@ -1879,20 +1879,20 @@
         android:protectionLevel="signature" />
 
     <!-- Allows a companion app to run in the background.
-         <p>Protection level: signature
+         <p>Protection level: normal
     -->
     <permission android:name="android.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND"
                 android:label="@string/permlab_runInBackground"
                 android:description="@string/permdesc_runInBackground"
-                android:protectionLevel="signature" />
+                android:protectionLevel="normal" />
 
     <!-- Allows a companion app to use data in the background.
-         <p>Protection level: signature
+         <p>Protection level: normal
     -->
     <permission android:name="android.permission.REQUEST_COMPANION_USE_DATA_IN_BACKGROUND"
                 android:label="@string/permlab_useDataInBackground"
                 android:description="@string/permdesc_useDataInBackground"
-                android:protectionLevel="signature" />
+                android:protectionLevel="normal" />
 
 
     <!-- ================================== -->
diff --git a/core/res/res/drawable/ic_picture_in_picture.xml b/core/res/res/drawable/ic_picture_in_picture.xml
deleted file mode 100644
index e2dda33..0000000
--- a/core/res/res/drawable/ic_picture_in_picture.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24"
-    android:viewportHeight="24">
-
-    <path
-        android:fillColor="#FFFFFF"
-        android:pathData="M19 11h-8v6h8v-6zm4 8V4.98C23 3.88 22.1 3 21 3H3c-1.1 0-2 .88-2 1.98V19c0 1.1 .9
-2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H3V4.97h18v14.05z" />
-    <path
-        android:pathData="M0 0h24v24H0V0z" />
-</vector>
\ No newline at end of file
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index c421514..cfe25b3 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -63,6 +63,12 @@
         <!-- Drawable to be drawn over the view to mark it as autofilled-->
         <attr name="autofilledHighlight" format="reference" />
 
+        <!-- Max width of the autofill data set picker as a fraction of the screen width -->
+        <attr name="autofillDatasetPickerMaxWidth" format="reference" />
+
+        <!-- Max height of the autofill data set picker as a fraction of the screen height -->
+        <attr name="autofillDatasetPickerMaxHeight" format="reference" />
+
         <!-- Default disabled alpha for widgets that set enabled/disabled alpha programmatically. -->
         <attr name="disabledAlpha" format="float" />
         <!-- The alpha applied to the foreground color to create the primary text color. -->
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index b7bc7b7..ced22cc 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -784,13 +784,13 @@
         <enum name="locked" value="14" />
     </attr>
 
-    <!-- Specify the configuration changes that trigger the system to restart the
+    <!-- Specify the configuration changes that trigger the system to recreate the
          current activity if any of these configuration changes happen in the system.
          The valid configuration changes include mcc and mnc which are the same with
-         those in configChanges. By default from Android O, we don't restart the activity
+         those in configChanges. By default from Android O, we don't recreate the activity
          even the app doesn't specify mcc or mnc in configChanges. If the app wants to
-         restart, specify them in restartOnConfigChanges. -->
-    <attr name="restartOnConfigChanges">
+         be recreated, specify them in recreateOnConfigChanges. -->
+    <attr name="recreateOnConfigChanges">
         <!-- The IMSI MCC has changed, that is a SIM has been detected and
              updated the Mobile Country Code. -->
         <flag name="mcc" value="0x0001" />
@@ -817,15 +817,15 @@
     <attr name="configChanges">
         <!-- The IMSI MCC has changed, that is a SIM has been detected and
              updated the Mobile Country Code. By default from Android O, we
-             don't restart the activity even the app doesn't specify mcc in
-             configChanges. If the app wants to restart, specify mcc in
-             restartOnConfigChanges. -->
+             don't recreate the activity even the app doesn't specify mcc in
+             configChanges. If the app wants to recreate the activity, specify
+             mcc in recreateOnConfigChanges. -->
         <flag name="mcc" value="0x0001" />
         <!-- The IMSI MNC has changed, that is a SIM has been detected and
              updated the Mobile Network Code. By default from Android O, we
-             don't restart the activity even the app doesn't specify mnc in
-             configChanges. If the app wants to restart, specify mnc in
-             restartOnConfigChanges. -->
+             don't recreate the activity even the app doesn't specify mnc in
+             configChanges. If the app wants to recreate the acvitity, specify
+             mnc in recreateOnConfigChanges. -->
         <flag name="mnc" value="0x0002" />
         <!-- The locale has changed, that is the user has selected a new
              language that text should be displayed in. -->
@@ -2048,7 +2048,7 @@
         <attr name="launchMode" />
         <attr name="screenOrientation" />
         <attr name="configChanges" />
-        <attr name="restartOnConfigChanges" />
+        <attr name="recreateOnConfigChanges" />
         <attr name="permission" />
         <attr name="multiprocess" />
         <attr name="process" />
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 0fa1fdb..a921fd7 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2863,4 +2863,13 @@
 
     <!-- The apps that need to be hidden when they are disabled -->
     <string-array name="config_hideWhenDisabled_packageNames"></string-array>
+
+    <!-- Additional non-platform defined global settings exposed to Instant Apps -->
+    <string-array name="config_allowedGlobalInstantAppSettings"></string-array>
+
+    <!-- Additional non-platform defined system settings exposed to Instant Apps -->
+    <string-array name="config_allowedSystemInstantAppSettings"></string-array>
+
+    <!-- Additional non-platform defined secure settings exposed to Instant Apps -->
+    <string-array name="config_allowedSecureInstantAppSettings"></string-array>
 </resources>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index ef6c21f..ece0e82 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -536,4 +536,8 @@
     <dimen name="item_touch_helper_max_drag_scroll_per_frame">20dp</dimen>
     <dimen name="item_touch_helper_swipe_escape_velocity">120dp</dimen>
     <dimen name="item_touch_helper_swipe_escape_max_velocity">800dp</dimen>
+
+    <!-- Max width/height of the autofill data set picker as a fraction of the screen width/height -->
+    <dimen name="autofill_dataset_picker_max_size">90%</dimen>
+
 </resources>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 17f4d39..42d3f27 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2786,7 +2786,7 @@
         <public name="appCategory" />
         <public name="autoSizeMaxTextSize" />
         <public name="__removed2" />
-        <public name="restartOnConfigChanges" />
+        <public name="recreateOnConfigChanges" />
         <public name="certDigest" />
         <public name="splitName" />
         <public name="colorMode" />
@@ -2834,11 +2834,6 @@
         <public name="autofill" />
     </public-group>
 
-    <public-group type="drawable" first-id="0x010800b5">
-        <!-- 0x010800b4 was removed -->
-        <public name="ic_picture_in_picture" />
-    </public-group>
-
     <public-group type="string" first-id="0x01040019">
         <public name="paste_as_plain_text" />
     </public-group>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 5c17788..1966f6a 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -239,7 +239,8 @@
   <java-symbol type="attr" name="accessibilityFocusedDrawable"/>
   <java-symbol type="attr" name="isLightTheme"/>
   <java-symbol type="attr" name="autofilledHighlight"/>
-
+  <java-symbol type="attr" name="autofillDatasetPickerMaxWidth"/>
+  <java-symbol type="attr" name="autofillDatasetPickerMaxHeight"/>
   <java-symbol type="bool" name="action_bar_embed_tabs" />
   <java-symbol type="bool" name="action_bar_expanded_action_views_exclusive" />
   <java-symbol type="bool" name="config_avoidGfxAccel" />
@@ -2906,6 +2907,7 @@
   <java-symbol type="string" name="autofill_save_type_email_address" />
   <java-symbol type="drawable" name="autofill_dataset_picker_background" />
   <java-symbol type="style" name="AutofillDatasetPicker" />
+  <java-symbol type="dimen" name="autofill_dataset_picker_max_size"/>
 
   <!-- Accessibility fingerprint gestures -->
   <java-symbol type="string" name="capability_title_canCaptureFingerprintGestures" />
@@ -3003,4 +3005,9 @@
   <java-symbol type="string" name="config_feedbackIntentNameKey" />
 
   <java-symbol type="array" name="config_hideWhenDisabled_packageNames" />
+
+  <java-symbol type="array" name="config_allowedGlobalInstantAppSettings" />
+  <java-symbol type="array" name="config_allowedSystemInstantAppSettings" />
+  <java-symbol type="array" name="config_allowedSecureInstantAppSettings" />
+
 </resources>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index e8fbf34..383ae5d 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -449,6 +449,10 @@
         <item name="tooltipFrameBackground">@drawable/tooltip_frame</item>
         <item name="tooltipForegroundColor">@color/bright_foreground_light</item>
         <item name="tooltipBackgroundColor">@color/tooltip_background_light</item>
+
+        <!-- Autofill: max width/height of the dataset picker as a fraction of screen size -->
+        <item name="autofillDatasetPickerMaxWidth">@dimen/autofill_dataset_picker_max_size</item>
+        <item name="autofillDatasetPickerMaxHeight">@dimen/autofill_dataset_picker_max_size</item>
     </style>
 
     <!-- Variant of {@link #Theme} with no title bar -->
diff --git a/core/tests/coretests/src/android/content/pm/PackageParserTest.java b/core/tests/coretests/src/android/content/pm/PackageParserTest.java
index ca4141a..b9bd193 100644
--- a/core/tests/coretests/src/android/content/pm/PackageParserTest.java
+++ b/core/tests/coretests/src/android/content/pm/PackageParserTest.java
@@ -220,41 +220,41 @@
      * Unit test for PackageParser.getActivityConfigChanges().
      * If the bit is 1 in the original configChanges, it is still 1 in the final configChanges.
      * If the bit is 0 in the original configChanges and the bit is not set to 1 in
-     * restartOnConfigChanges, the bit is changed to 1 in the final configChanges by default.
+     * recreateOnConfigChanges, the bit is changed to 1 in the final configChanges by default.
      */
     @Test
     public void testGetActivityConfigChanges() {
-        // Not set in either configChanges or restartOnConfigChanges.
+        // Not set in either configChanges or recreateOnConfigChanges.
         int configChanges = 0x0000; // 00000000.
-        int restartOnConfigChanges = 0x0000; // 00000000.
+        int recreateOnConfigChanges = 0x0000; // 00000000.
         int finalConfigChanges =
-                PackageParser.getActivityConfigChanges(configChanges, restartOnConfigChanges);
+                PackageParser.getActivityConfigChanges(configChanges, recreateOnConfigChanges);
         assertEquals(0x0003, finalConfigChanges); // Should be 00000011.
 
-        // Not set in configChanges, but set in restartOnConfigChanges.
+        // Not set in configChanges, but set in recreateOnConfigChanges.
         configChanges = 0x0000; // 00000000.
-        restartOnConfigChanges = 0x0003; // 00000011.
+        recreateOnConfigChanges = 0x0003; // 00000011.
         finalConfigChanges =
-                PackageParser.getActivityConfigChanges(configChanges, restartOnConfigChanges);
+                PackageParser.getActivityConfigChanges(configChanges, recreateOnConfigChanges);
         assertEquals(0x0000, finalConfigChanges); // Should be 00000000.
 
         // Set in configChanges.
         configChanges = 0x0003; // 00000011.
-        restartOnConfigChanges = 0X0000; // 00000000.
+        recreateOnConfigChanges = 0X0000; // 00000000.
         finalConfigChanges =
-                PackageParser.getActivityConfigChanges(configChanges, restartOnConfigChanges);
+                PackageParser.getActivityConfigChanges(configChanges, recreateOnConfigChanges);
         assertEquals(0x0003, finalConfigChanges); // Should be 00000011.
 
-        restartOnConfigChanges = 0x0003; // 00000011.
+        recreateOnConfigChanges = 0x0003; // 00000011.
         finalConfigChanges =
-                PackageParser.getActivityConfigChanges(configChanges, restartOnConfigChanges);
+                PackageParser.getActivityConfigChanges(configChanges, recreateOnConfigChanges);
         assertEquals(0x0003, finalConfigChanges); // Should still be 00000011.
 
         // Other bit set in configChanges.
         configChanges = 0x0080; // 10000000, orientation.
-        restartOnConfigChanges = 0x0000; // 00000000.
+        recreateOnConfigChanges = 0x0000; // 00000000.
         finalConfigChanges =
-                PackageParser.getActivityConfigChanges(configChanges, restartOnConfigChanges);
+                PackageParser.getActivityConfigChanges(configChanges, recreateOnConfigChanges);
         assertEquals(0x0083, finalConfigChanges); // Should be 10000011.
     }
 }
diff --git a/core/tests/coretests/src/android/graphics/ColorSpaceRendererTest.java b/core/tests/coretests/src/android/graphics/ColorSpaceRendererTest.java
new file mode 100644
index 0000000..6e38fb6
--- /dev/null
+++ b/core/tests/coretests/src/android/graphics/ColorSpaceRendererTest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2017 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.graphics;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class ColorSpaceRendererTest {
+
+    @Test
+    public void testRendererSize() {
+        Bitmap b = ColorSpace.createRenderer()
+                .size(0)
+                .render();
+        assertEquals(128, b.getWidth());
+        assertEquals(128, b.getHeight());
+
+        b = ColorSpace.createRenderer()
+                .size(768)
+                .render();
+        assertEquals(768, b.getWidth());
+        assertEquals(768, b.getHeight());
+    }
+
+    @Test
+    public void testRenderer() {
+        Bitmap b = ColorSpace.createRenderer()
+                .size(1024)
+                .clip(true)
+                .showWhitePoint(false)
+                .add(ColorSpace.get(ColorSpace.Named.SRGB), 0xffffffff)
+                .add(ColorSpace.get(ColorSpace.Named.DCI_P3), 0xffffffff)
+                .add(ColorSpace.get(ColorSpace.Named.PRO_PHOTO_RGB), 0.1f, 0.5f, 0.1f, 0xff000000)
+                .add(ColorSpace.get(ColorSpace.Named.ADOBE_RGB), 0.1f, 0.5f, 0.1f, 0xff000000)
+                .render();
+        assertNotNull(b);
+    }
+
+    @Test
+    public void testUcsRenderer() {
+        Bitmap b = ColorSpace.createRenderer()
+                .size(1024)
+                .clip(true)
+                .showWhitePoint(false)
+                .uniformChromaticityScale(true)
+                .add(ColorSpace.get(ColorSpace.Named.SRGB), 0xffffffff)
+                .add(ColorSpace.get(ColorSpace.Named.DCI_P3), 0xffffffff)
+                .add(ColorSpace.get(ColorSpace.Named.PRO_PHOTO_RGB), 0.1f, 0.5f, 0.1f, 0xff000000)
+                .add(ColorSpace.get(ColorSpace.Named.ADOBE_RGB), 0.1f, 0.5f, 0.1f, 0xff000000)
+                .render();
+        assertNotNull(b);
+    }
+}
diff --git a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
index ffadad9..ab10e97 100644
--- a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
+++ b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
@@ -78,6 +78,7 @@
      * Mask path is defined inside device configuration in following dimension: [100 x 100]
      * @hide
      */
+    @TestApi
     public static final float MASK_SIZE = 100f;
 
     /**
@@ -179,7 +180,6 @@
      *
      * @param backgroundDrawable drawable that should be rendered in the background
      * @param foregroundDrawable drawable that should be rendered in the foreground
-     * @hide
      */
     public AdaptiveIconDrawable(Drawable backgroundDrawable,
             Drawable foregroundDrawable) {
diff --git a/media/java/android/media/AudioFocusRequest.java b/media/java/android/media/AudioFocusRequest.java
index 29d1986..b1dc3ad 100644
--- a/media/java/android/media/AudioFocusRequest.java
+++ b/media/java/android/media/AudioFocusRequest.java
@@ -357,6 +357,20 @@
         }
 
         /**
+         * @hide
+         * Internal listener setter, no null checks on listener nor handler
+         * @param listener
+         * @param handler
+         * @return this {@code Builder} instance.
+         */
+        @NonNull Builder setOnAudioFocusChangeListenerInt(
+                OnAudioFocusChangeListener listener, Handler handler) {
+            mFocusListener = listener;
+            mListenerHandler = handler;
+            return this;
+        }
+
+        /**
          * Sets the listener called when audio focus changes after being requested with
          *   {@link AudioManager#requestAudioFocus(AudioFocusRequest)}, and until being abandoned
          *   with {@link AudioManager#abandonAudioFocusRequest(AudioFocusRequest)}.
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index ce07c99..0b5dff2 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -2445,7 +2445,7 @@
         }
 
         final AudioFocusRequest afr = new AudioFocusRequest.Builder(durationHint)
-                .setOnAudioFocusChangeListener(l, null /* no Handler for this legacy API */)
+                .setOnAudioFocusChangeListenerInt(l, null /* no Handler for this legacy API */)
                 .setAudioAttributes(requestAttributes)
                 .setAcceptsDelayedFocusGain((flags & AUDIOFOCUS_FLAG_DELAY_OK)
                         == AUDIOFOCUS_FLAG_DELAY_OK)
diff --git a/media/java/android/media/tv/TvContract.java b/media/java/android/media/tv/TvContract.java
index 6f4118e..4496a82 100644
--- a/media/java/android/media/tv/TvContract.java
+++ b/media/java/android/media/tv/TvContract.java
@@ -437,7 +437,7 @@
     public static final String PARAM_BROWSABLE_ONLY = "browsable_only";
 
     /**
-     * A optional query, update or delete URI parameter that allows the caller to specify canonical
+     * An optional query, update or delete URI parameter that allows the caller to specify canonical
      * genre to filter programs.
      * @hide
      */
@@ -452,6 +452,13 @@
     public static final String PARAM_PREVIEW = "preview";
 
     /**
+     * An optional query, update or delete URI parameter that allows the caller to specify package
+     * name to filter channels.
+     * @hide
+     */
+    public static final String PARAM_PACKAGE = "package";
+
+    /**
      * Builds an ID that uniquely identifies a TV input service.
      *
      * @param name The {@link ComponentName} of the TV input service to build ID for.
diff --git a/packages/SettingsLib/src/com/android/settingslib/deviceinfo/PrivateStorageInfo.java b/packages/SettingsLib/src/com/android/settingslib/deviceinfo/PrivateStorageInfo.java
index ccf7a0b..39dfe0e 100644
--- a/packages/SettingsLib/src/com/android/settingslib/deviceinfo/PrivateStorageInfo.java
+++ b/packages/SettingsLib/src/com/android/settingslib/deviceinfo/PrivateStorageInfo.java
@@ -33,7 +33,7 @@
     public final long freeBytes;
     public final long totalBytes;
 
-    private PrivateStorageInfo(long freeBytes, long totalBytes) {
+    public PrivateStorageInfo(long freeBytes, long totalBytes) {
         this.freeBytes = freeBytes;
         this.totalBytes = totalBytes;
     }
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index a6347c6..4b304b2 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -35,6 +35,7 @@
 import android.content.pm.ResolveInfo;
 import android.content.pm.ServiceInfo;
 import android.content.pm.UserInfo;
+import android.content.res.Resources;
 import android.database.Cursor;
 import android.database.MatrixCursor;
 import android.database.sqlite.SQLiteDatabase;
@@ -185,6 +186,26 @@
     private static final Bundle NULL_SETTING_BUNDLE = Bundle.forPair(
             Settings.NameValueTable.VALUE, null);
 
+    // Overlay specified settings whitelisted for Instant Apps
+    private static final Set<String> OVERLAY_ALLOWED_GLOBAL_INSTANT_APP_SETTINGS = new ArraySet<>();
+    private static final Set<String> OVERLAY_ALLOWED_SYSTEM_INSTANT_APP_SETTINGS = new ArraySet<>();
+    private static final Set<String> OVERLAY_ALLOWED_SECURE_INSTANT_APP_SETTINGS = new ArraySet<>();
+
+    static {
+        for (String name : Resources.getSystem().getStringArray(
+                com.android.internal.R.array.config_allowedGlobalInstantAppSettings)) {
+            OVERLAY_ALLOWED_GLOBAL_INSTANT_APP_SETTINGS.add(name);
+        }
+        for (String name : Resources.getSystem().getStringArray(
+                com.android.internal.R.array.config_allowedSystemInstantAppSettings)) {
+            OVERLAY_ALLOWED_SYSTEM_INSTANT_APP_SETTINGS.add(name);
+        }
+        for (String name : Resources.getSystem().getStringArray(
+                com.android.internal.R.array.config_allowedSecureInstantAppSettings)) {
+            OVERLAY_ALLOWED_SECURE_INSTANT_APP_SETTINGS.add(name);
+        }
+    }
+
     // Changes to these global settings are synchronously persisted
     private static final Set<String> CRITICAL_GLOBAL_SETTINGS = new ArraySet<>();
     static {
@@ -898,14 +919,13 @@
             Slog.v(LOG_TAG, "getGlobalSetting(" + name + ")");
         }
 
+        // Ensure the caller can access the setting.
+        enforceSettingReadable(name, SETTINGS_TYPE_GLOBAL, UserHandle.getCallingUserId());
+
         // Get the value.
         synchronized (mLock) {
-            Setting setting = mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_GLOBAL,
+            return mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_GLOBAL,
                     UserHandle.USER_SYSTEM, name);
-            // Ensure the caller can access the setting before we return it.
-            enforceSettingReadable(setting, name, SETTINGS_TYPE_GLOBAL,
-                    UserHandle.getCallingUserId());
-            return setting;
         }
     }
 
@@ -1063,6 +1083,9 @@
         // Resolve the userId on whose behalf the call is made.
         final int callingUserId = resolveCallingUserIdEnforcingPermissionsLocked(requestingUserId);
 
+        // Ensure the caller can access the setting.
+        enforceSettingReadable(name, SETTINGS_TYPE_SECURE, UserHandle.getCallingUserId());
+
         // Determine the owning user as some profile settings are cloned from the parent.
         final int owningUserId = resolveOwningUserIdForSecureSettingLocked(callingUserId, name);
 
@@ -1076,7 +1099,6 @@
 
         // As of Android O, the SSAID is read from an app-specific entry in table
         // SETTINGS_FILE_SSAID, unless accessed by a system process.
-        // All apps are allowed to access their SSAID, so we skip the permission check.
         if (isNewSsaidSetting(name)) {
             PackageInfo callingPkg = getCallingPackageInfo(owningUserId);
             synchronized (mLock) {
@@ -1086,12 +1108,8 @@
 
         // Not the SSAID; do a straight lookup
         synchronized (mLock) {
-            Setting setting = mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_SECURE,
+            return mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_SECURE,
                     owningUserId, name);
-            // Ensure the caller can access the setting before we return it.
-            enforceSettingReadable(setting, name, SETTINGS_TYPE_SECURE,
-                    UserHandle.getCallingUserId());
-            return setting;
         }
     }
 
@@ -1292,18 +1310,15 @@
         // Resolve the userId on whose behalf the call is made.
         final int callingUserId = resolveCallingUserIdEnforcingPermissionsLocked(requestingUserId);
 
+        // Ensure the caller can access the setting.
+        enforceSettingReadable(name, SETTINGS_TYPE_SYSTEM, UserHandle.getCallingUserId());
 
         // Determine the owning user as some profile settings are cloned from the parent.
         final int owningUserId = resolveOwningUserIdForSystemSettingLocked(callingUserId, name);
 
         // Get the value.
         synchronized (mLock) {
-            Setting setting = mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_SYSTEM,
-                    owningUserId, name);
-            // Ensure the caller can access the setting before we return it.
-            enforceSettingReadable(setting, name, SETTINGS_TYPE_SYSTEM,
-                    UserHandle.getCallingUserId());
-            return setting;
+            return mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_SYSTEM, owningUserId, name);
         }
     }
 
@@ -1635,6 +1650,19 @@
         }
     }
 
+    private Set<String> getOverlayInstantAppAccessibleSettings(int settingsType) {
+        switch (settingsType) {
+            case SETTINGS_TYPE_GLOBAL:
+                return OVERLAY_ALLOWED_GLOBAL_INSTANT_APP_SETTINGS;
+            case SETTINGS_TYPE_SYSTEM:
+                return OVERLAY_ALLOWED_SYSTEM_INSTANT_APP_SETTINGS;
+            case SETTINGS_TYPE_SECURE:
+                return OVERLAY_ALLOWED_SECURE_INSTANT_APP_SETTINGS;
+            default:
+                throw new IllegalArgumentException("Invalid settings type: " + settingsType);
+        }
+    }
+
     private List<String> getSettingsNamesLocked(int settingsType, int userId) {
         boolean instantApp;
         if (UserHandle.getAppId(Binder.getCallingUid()) < Process.FIRST_APPLICATION_UID) {
@@ -1650,23 +1678,16 @@
         }
     }
 
-    private void enforceSettingReadable(Setting setting, String settingName, int settingsType,
-            int userId) {
+    private void enforceSettingReadable(String settingName, int settingsType, int userId) {
         if (UserHandle.getAppId(Binder.getCallingUid()) < Process.FIRST_APPLICATION_UID) {
             return;
         }
         ApplicationInfo ai = getCallingApplicationInfoOrThrow();
-        // Installed apps are allowed to read all settings.
         if (!ai.isInstantApp()) {
             return;
         }
-        // Instant Apps are allowed to read settings defined by applications.
-        // TODO: Replace this with an API that allows the setting application to say if a setting
-        // shoud/shouldn't be accessible.
-        if (!setting.isDefaultFromSystem()) {
-            return;
-        }
-        if (!getInstantAppAccessibleSettings(settingsType).contains(settingName)) {
+        if (!getInstantAppAccessibleSettings(settingsType).contains(settingName)
+                && !getOverlayInstantAppAccessibleSettings(settingsType).contains(settingName)) {
             throw new SecurityException("Setting " + settingName + " is not accessible from"
                     + " ephemeral package " + getCallingPackage());
         }
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index cdb5af9..f072849 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -130,6 +130,9 @@
     <!-- size at which Notification icons will be drawn in the status bar -->
     <dimen name="status_bar_icon_drawing_size">17dp</dimen>
 
+    <!-- size at which Notification icons will be drawn on Ambient Display -->
+    <dimen name="status_bar_icon_drawing_size_dark">@*android:dimen/notification_header_icon_size_ambient</dimen>
+
     <!-- opacity at which Notification icons will be drawn in the status bar -->
     <item type="dimen" name="status_bar_icon_drawing_alpha">90%</item>
 
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
index 28bd23c..df03fdc 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
@@ -103,6 +103,7 @@
             // Re-enable touches after the animation completes
             mTouchHandler.setTouchEnabled(true);
             mTouchHandler.onPinnedStackAnimationEnded();
+            mMenuController.onPinnedStackAnimationEnded();
         }
 
         @Override
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
index 79ac816..65f24cf 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
@@ -80,6 +80,7 @@
     public static final int MESSAGE_HIDE_MENU = 3;
     public static final int MESSAGE_UPDATE_ACTIONS = 4;
     public static final int MESSAGE_UPDATE_DISMISS_FRACTION = 5;
+    public static final int MESSAGE_ANIMATION_ENDED = 6;
 
     private static final long INITIAL_DISMISS_DELAY = 3500;
     private static final long POST_INTERACTION_DISMISS_DELAY = 2000;
@@ -92,6 +93,7 @@
 
     private int mMenuState;
     private boolean mAllowMenuTimeout = true;
+    private boolean mAllowTouches = true;
 
     private final List<RemoteAction> mActions = new ArrayList<>();
 
@@ -149,6 +151,10 @@
                     updateDismissFraction(data.getFloat(EXTRA_DISMISS_FRACTION));
                     break;
                 }
+                case MESSAGE_ANIMATION_ENDED: {
+                    mAllowTouches = true;
+                    break;
+                }
             }
         }
     });
@@ -245,6 +251,10 @@
 
     @Override
     public boolean dispatchTouchEvent(MotionEvent ev) {
+        if (!mAllowTouches) {
+            return super.dispatchTouchEvent(ev);
+        }
+
         // On the first action outside the window, hide the menu
         switch (ev.getAction()) {
             case MotionEvent.ACTION_OUTSIDE:
@@ -284,6 +294,9 @@
             boolean allowMenuTimeout) {
         mAllowMenuTimeout = allowMenuTimeout;
         if (mMenuState != menuState) {
+            boolean deferTouchesUntilAnimationEnds = (mMenuState == MENU_STATE_FULL) ||
+                    (menuState == MENU_STATE_FULL);
+            mAllowTouches = !deferTouchesUntilAnimationEnds;
             cancelDelayedFinish();
             updateActionViews(stackBounds);
             if (mMenuContainerAnimator != null) {
@@ -447,8 +460,8 @@
                         });
                     } else {
                         actionView.setAlpha(DISABLED_ACTION_ALPHA);
-                        actionView.setEnabled(false);
                     }
+                    actionView.setEnabled(action.isEnabled());
 
                     // Update the margin between actions
                     LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
index c41f898..d5cf1dd 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
@@ -197,6 +197,19 @@
         }
     }
 
+    public void onPinnedStackAnimationEnded() {
+        // Note: Only active menu activities care about this event
+        if (mToActivityMessenger != null) {
+            Message m = Message.obtain();
+            m.what = PipMenuActivity.MESSAGE_ANIMATION_ENDED;
+            try {
+                mToActivityMessenger.send(m);
+            } catch (RemoteException e) {
+                Log.e(TAG, "Could not notify menu pinned animation ended", e);
+            }
+        }
+    }
+
     /**
      * Adds a new menu activity listener.
      */
diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
index daf0622..6b3daa3 100644
--- a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
+++ b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
@@ -36,6 +36,7 @@
 import android.os.SystemClock;
 import android.os.UserHandle;
 import android.provider.Settings;
+import android.support.annotation.VisibleForTesting;
 import android.util.Slog;
 
 import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
@@ -71,6 +72,10 @@
     private static final String ACTION_DISMISSED_WARNING = "PNW.dismissedWarning";
     private static final String ACTION_CLICKED_TEMP_WARNING = "PNW.clickedTempWarning";
     private static final String ACTION_DISMISSED_TEMP_WARNING = "PNW.dismissedTempWarning";
+    private static final String ACTION_CLICKED_THERMAL_SHUTDOWN_WARNING =
+            "PNW.clickedThermalShutdownWarning";
+    private static final String ACTION_DISMISSED_THERMAL_SHUTDOWN_WARNING =
+            "PNW.dismissedThermalShutdownWarning";
 
     private static final AudioAttributes AUDIO_ATTRIBUTES = new AudioAttributes.Builder()
             .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
@@ -95,8 +100,9 @@
     private boolean mPlaySound;
     private boolean mInvalidCharger;
     private SystemUIDialog mSaverConfirmation;
-    private boolean mTempWarning;
+    private boolean mHighTempWarning;
     private SystemUIDialog mHighTempDialog;
+    private SystemUIDialog mThermalShutdownDialog;
 
     public PowerNotificationWarnings(Context context, NotificationManager notificationManager,
             StatusBar statusBar) {
@@ -113,8 +119,10 @@
         pw.print("mInvalidCharger="); pw.println(mInvalidCharger);
         pw.print("mShowing="); pw.println(SHOWING_STRINGS[mShowing]);
         pw.print("mSaverConfirmation="); pw.println(mSaverConfirmation != null ? "not null" : null);
-        pw.print("mTempWarning="); pw.println(mTempWarning);
+        pw.print("mHighTempWarning="); pw.println(mHighTempWarning);
         pw.print("mHighTempDialog="); pw.println(mHighTempDialog != null ? "not null" : null);
+        pw.print("mThermalShutdownDialog=");
+        pw.println(mThermalShutdownDialog != null ? "not null" : null);
     }
 
     @Override
@@ -212,29 +220,29 @@
     }
 
     @Override
-    public void dismissTemperatureWarning() {
-        if (!mTempWarning) {
+    public void dismissHighTemperatureWarning() {
+        if (!mHighTempWarning) {
             return;
         }
-        mTempWarning = false;
-        dismissTemperatureWarningInternal();
+        mHighTempWarning = false;
+        dismissHighTemperatureWarningInternal();
     }
 
     /**
-     * Internal only version of {@link #dismissTemperatureWarning()} that simply dismisses
+     * Internal only version of {@link #dismissHighTemperatureWarning()} that simply dismisses
      * the notification. As such, the notification will not show again until
-     * {@link #dismissTemperatureWarning()} is called.
+     * {@link #dismissHighTemperatureWarning()} is called.
      */
-    private void dismissTemperatureWarningInternal() {
+    private void dismissHighTemperatureWarningInternal() {
         mNoMan.cancelAsUser(TAG_TEMPERATURE, SystemMessage.NOTE_HIGH_TEMP, UserHandle.ALL);
     }
 
     @Override
-    public void showTemperatureWarning() {
-        if (mTempWarning) {
+    public void showHighTemperatureWarning() {
+        if (mHighTempWarning) {
             return;
         }
-        mTempWarning = true;
+        mHighTempWarning = true;
         final Notification.Builder nb =
                 new Notification.Builder(mContext, NotificationChannels.ALERTS)
                         .setSmallIcon(R.drawable.ic_device_thermostat_24)
@@ -249,10 +257,9 @@
         SystemUI.overrideNotificationAppName(mContext, nb);
         final Notification n = nb.build();
         mNoMan.notifyAsUser(TAG_TEMPERATURE, SystemMessage.NOTE_HIGH_TEMP, n, UserHandle.ALL);
-
     }
 
-    private void showTemperatureDialog() {
+    private void showHighTemperatureDialog() {
         if (mHighTempDialog != null) return;
         final SystemUIDialog d = new SystemUIDialog(mContext);
         d.setIconAttribute(android.R.attr.alertDialogIcon);
@@ -265,6 +272,44 @@
         mHighTempDialog = d;
     }
 
+    @VisibleForTesting
+    void dismissThermalShutdownWarning() {
+        mNoMan.cancelAsUser(TAG_TEMPERATURE, SystemMessage.NOTE_THERMAL_SHUTDOWN, UserHandle.ALL);
+    }
+
+    private void showThermalShutdownDialog() {
+        if (mThermalShutdownDialog != null) return;
+        final SystemUIDialog d = new SystemUIDialog(mContext);
+        d.setIconAttribute(android.R.attr.alertDialogIcon);
+        d.setTitle(R.string.thermal_shutdown_title);
+        d.setMessage(R.string.thermal_shutdown_dialog_message);
+        d.setPositiveButton(com.android.internal.R.string.ok, null);
+        d.setShowForAllUsers(true);
+        d.setOnDismissListener(dialog -> mThermalShutdownDialog = null);
+        d.show();
+        mThermalShutdownDialog = d;
+    }
+
+    @Override
+    public void showThermalShutdownWarning() {
+        final Notification.Builder nb =
+                new Notification.Builder(mContext, NotificationChannels.ALERTS)
+                        .setSmallIcon(R.drawable.ic_device_thermostat_24)
+                        .setWhen(0)
+                        .setShowWhen(false)
+                        .setContentTitle(mContext.getString(R.string.thermal_shutdown_title))
+                        .setContentText(mContext.getString(R.string.thermal_shutdown_message))
+                        .setVisibility(Notification.VISIBILITY_PUBLIC)
+                        .setContentIntent(pendingBroadcast(ACTION_CLICKED_THERMAL_SHUTDOWN_WARNING))
+                        .setDeleteIntent(
+                                pendingBroadcast(ACTION_DISMISSED_THERMAL_SHUTDOWN_WARNING))
+                        .setColor(Utils.getColorAttr(mContext, android.R.attr.colorError));
+        SystemUI.overrideNotificationAppName(mContext, nb);
+        final Notification n = nb.build();
+        mNoMan.notifyAsUser(
+                TAG_TEMPERATURE, SystemMessage.NOTE_THERMAL_SHUTDOWN, n, UserHandle.ALL);
+    }
+
     @Override
     public void updateLowBatteryWarning() {
         updateNotification();
@@ -380,6 +425,8 @@
             filter.addAction(ACTION_DISMISSED_WARNING);
             filter.addAction(ACTION_CLICKED_TEMP_WARNING);
             filter.addAction(ACTION_DISMISSED_TEMP_WARNING);
+            filter.addAction(ACTION_CLICKED_THERMAL_SHUTDOWN_WARNING);
+            filter.addAction(ACTION_DISMISSED_THERMAL_SHUTDOWN_WARNING);
             mContext.registerReceiverAsUser(this, UserHandle.ALL, filter,
                     android.Manifest.permission.STATUS_BAR_SERVICE, mHandler);
         }
@@ -397,10 +444,15 @@
             } else if (action.equals(ACTION_DISMISSED_WARNING)) {
                 dismissLowBatteryWarning();
             } else if (ACTION_CLICKED_TEMP_WARNING.equals(action)) {
-                dismissTemperatureWarningInternal();
-                showTemperatureDialog();
+                dismissHighTemperatureWarningInternal();
+                showHighTemperatureDialog();
             } else if (ACTION_DISMISSED_TEMP_WARNING.equals(action)) {
-                dismissTemperatureWarningInternal();
+                dismissHighTemperatureWarningInternal();
+            } else if (ACTION_CLICKED_THERMAL_SHUTDOWN_WARNING.equals(action)) {
+                dismissThermalShutdownWarning();
+                showThermalShutdownDialog();
+            } else if (ACTION_DISMISSED_THERMAL_SHUTDOWN_WARNING.equals(action)) {
+                dismissThermalShutdownWarning();
             }
         }
     }
diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
index 471c3ae..a642077 100644
--- a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
+++ b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
@@ -31,6 +31,7 @@
 import android.os.SystemClock;
 import android.os.UserHandle;
 import android.provider.Settings;
+import android.text.TextUtils;
 import android.text.format.DateUtils;
 import android.util.Log;
 import android.util.Slog;
@@ -93,6 +94,10 @@
         updateBatteryWarningLevels();
         mReceiver.init();
 
+        // Check to see if we need to let the user know that the phone previously shut down due
+        // to the temperature being too high.
+        showThermalShutdownDialog();
+
         initTemperatureWarning();
     }
 
@@ -256,6 +261,13 @@
         updateTemperatureWarning();
     }
 
+    private void showThermalShutdownDialog() {
+        if (mPowerManager.getLastShutdownReason()
+                == PowerManager.SHUTDOWN_REASON_THERMAL_SHUTDOWN) {
+            mWarnings.showThermalShutdownWarning();
+        }
+    }
+
     private void updateTemperatureWarning() {
         float[] temps = mHardwarePropertiesManager.getDeviceTemperatures(
                 HardwarePropertiesManager.DEVICE_TEMPERATURE_SKIN,
@@ -268,9 +280,9 @@
             if (statusBar != null && !statusBar.isDeviceInVrMode()
                     && temp >= mThresholdTemp) {
                 logAtTemperatureThreshold(temp);
-                mWarnings.showTemperatureWarning();
+                mWarnings.showHighTemperatureWarning();
             } else {
-                mWarnings.dismissTemperatureWarning();
+                mWarnings.dismissHighTemperatureWarning();
             }
         }
 
@@ -369,8 +381,9 @@
         void showInvalidChargerWarning();
         void updateLowBatteryWarning();
         boolean isInvalidChargerWarningShowing();
-        void dismissTemperatureWarning();
-        void showTemperatureWarning();
+        void dismissHighTemperatureWarning();
+        void showHighTemperatureWarning();
+        void showThermalShutdownWarning();
         void dump(PrintWriter pw);
         void userSwitched();
     }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
index 53a9eae..2b812a5 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
@@ -331,8 +331,7 @@
                 RecentsActivityLaunchState launchState = config.getLaunchState();
                 if (!launchState.launchedWithAltTab) {
                     // Has the user tapped quickly?
-                    boolean isQuickTap = ViewConfiguration.getDoubleTapMinTime() < elapsedTime &&
-                            elapsedTime < ViewConfiguration.getDoubleTapTimeout();
+                    boolean isQuickTap = elapsedTime < ViewConfiguration.getDoubleTapTimeout();
                     if (Recents.getConfiguration().isGridEnabled) {
                         if (isQuickTap) {
                             EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationSnooze.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationSnooze.java
index ccc99c5..8b3d6d9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationSnooze.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationSnooze.java
@@ -145,13 +145,15 @@
     }
 
     private void showSnoozeOptions(boolean show) {
-        mExpanded = show;
-        animateSnoozeOptions(show);
         int drawableId = show ? com.android.internal.R.drawable.ic_collapse_notification
                 : com.android.internal.R.drawable.ic_expand_notification;
         mExpandButton.setImageResource(drawableId);
-        if (mGutsContainer != null) {
-            mGutsContainer.onHeightChanged();
+        if (mExpanded != show) {
+            mExpanded = show;
+            animateSnoozeOptions(show);
+            if (mGutsContainer != null) {
+                mGutsContainer.onHeightChanged();
+            }
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index 263df79..c7fbbf9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -89,6 +89,9 @@
     };
 
     private boolean mAlwaysScaleIcon;
+    private int mStatusBarIconDrawingSizeDark = 1;
+    private int mStatusBarIconDrawingSize = 1;
+    private int mStatusBarIconSize = 1;
     private StatusBarIcon mIcon;
     @ViewDebug.ExportedProperty private String mSlot;
     private Drawable mNumberBackground;
@@ -139,7 +142,7 @@
         mNumberPain.setColor(context.getColor(R.drawable.notification_number_text_color));
         mNumberPain.setAntiAlias(true);
         setNotification(notification);
-        maybeUpdateIconScale();
+        maybeUpdateIconScaleDimens();
         setScaleType(ScaleType.CENTER);
         mDensity = context.getResources().getDisplayMetrics().densityDpi;
         if (mNotification != null) {
@@ -149,18 +152,30 @@
         reloadDimens();
     }
 
-    private void maybeUpdateIconScale() {
+    private void maybeUpdateIconScaleDimens() {
         // We do not resize and scale system icons (on the right), only notification icons (on the
         // left).
         if (mNotification != null || mAlwaysScaleIcon) {
-            updateIconScale();
+            updateIconScaleDimens();
         }
     }
 
-    private void updateIconScale() {
+    private void updateIconScaleDimens() {
         Resources res = mContext.getResources();
-        final int outerBounds = res.getDimensionPixelSize(R.dimen.status_bar_icon_size);
-        final int imageBounds = res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size);
+        mStatusBarIconSize = res.getDimensionPixelSize(R.dimen.status_bar_icon_size);
+        mStatusBarIconDrawingSizeDark =
+                res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size_dark);
+        mStatusBarIconDrawingSize =
+                res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size);
+        updateIconScale();
+    }
+
+    private void updateIconScale() {
+        final float imageBounds = NotificationUtils.interpolate(
+                mStatusBarIconDrawingSize,
+                mStatusBarIconDrawingSizeDark,
+                mDarkAmount);
+        final int outerBounds = mStatusBarIconSize;
         mIconScale = (float)imageBounds / (float)outerBounds;
     }
 
@@ -174,7 +189,7 @@
         int density = newConfig.densityDpi;
         if (density != mDensity) {
             mDensity = density;
-            maybeUpdateIconScale();
+            maybeUpdateIconScaleDimens();
             updateDrawable();
             reloadDimens();
         }
@@ -198,7 +213,7 @@
         mDozer = new NotificationIconDozeHelper(context);
         mBlocked = false;
         mAlwaysScaleIcon = true;
-        updateIconScale();
+        updateIconScaleDimens();
         mDensity = context.getResources().getDisplayMetrics().densityDpi;
     }
 
@@ -681,6 +696,7 @@
     public void setDark(boolean dark, boolean fade, long delay) {
         mDozer.setIntensityDark(f -> {
             mDarkAmount = f;
+            updateIconScale();
             updateDecorColor();
             updateIconColor();
         }, dark, fade, delay);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/power/PowerNotificationWarningsTest.java b/packages/SystemUI/tests/src/com/android/systemui/power/PowerNotificationWarningsTest.java
index 34cfa7b..eb59a34 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/power/PowerNotificationWarningsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/power/PowerNotificationWarningsTest.java
@@ -24,7 +24,6 @@
 
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.anyInt;
 import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
@@ -129,17 +128,32 @@
     }
 
     @Test
-    public void testShowTemperatureWarning_NotifyAsUser() {
-        mPowerNotificationWarnings.showTemperatureWarning();
+    public void testShowHighTemperatureWarning_NotifyAsUser() {
+        mPowerNotificationWarnings.showHighTemperatureWarning();
         verify(mMockNotificationManager, times(1))
                 .notifyAsUser(anyString(), eq(SystemMessage.NOTE_HIGH_TEMP), any(), any());
     }
 
     @Test
-    public void testDismissTemperatureWarning_CancelAsUser() {
-        mPowerNotificationWarnings.showTemperatureWarning();
-        mPowerNotificationWarnings.dismissTemperatureWarning();
+    public void testDismissHighTemperatureWarning_CancelAsUser() {
+        mPowerNotificationWarnings.showHighTemperatureWarning();
+        mPowerNotificationWarnings.dismissHighTemperatureWarning();
         verify(mMockNotificationManager, times(1)).cancelAsUser(anyString(),
                 eq(SystemMessage.NOTE_HIGH_TEMP), any());
     }
+
+    @Test
+    public void testShowThermalShutdownWarning_NotifyAsUser() {
+        mPowerNotificationWarnings.showThermalShutdownWarning();
+        verify(mMockNotificationManager, times(1))
+                .notifyAsUser(anyString(), eq(SystemMessage.NOTE_THERMAL_SHUTDOWN), any(), any());
+    }
+
+    @Test
+    public void testDismissThermalShutdownWarning_CancelAsUser() {
+        mPowerNotificationWarnings.showThermalShutdownWarning();
+        mPowerNotificationWarnings.dismissThermalShutdownWarning();
+        verify(mMockNotificationManager, times(1)).cancelAsUser(anyString(),
+                eq(SystemMessage.NOTE_THERMAL_SHUTDOWN), any());
+    }
 }
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
index 2358ec5..b536ad9 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
@@ -603,15 +603,12 @@
             if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
 
             boolean oldDebug = sDebug;
-            boolean oldVerbose = sVerbose;
             try {
                 synchronized (mLock) {
                     oldDebug = sDebug;
-                    oldVerbose = sVerbose;
                     setDebugLocked(true);
-                    setVerboseLocked(true);
                     pw.print("Debug mode: "); pw.println(oldDebug);
-                    pw.print("Verbose mode: "); pw.println(oldVerbose);
+                    pw.print("Verbose mode: "); pw.println(sVerbose);
                     pw.print("Disabled users: "); pw.println(mDisabledUsers);
                     final int size = mServicesCache.size();
                     pw.print("Cached services: ");
@@ -631,7 +628,6 @@
                 mRequestsHistory.reverseDump(fd, pw, args);
             } finally {
                 setDebugLocked(oldDebug);
-                setVerboseLocked(oldVerbose);
             }
         }
 
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index c85ce43..018fb68 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -922,6 +922,10 @@
                     }
                 }
             }
+
+            if (ArrayUtils.contains(response.getAuthenticationIds(), id)) {
+                return false;
+            }
         }
 
         return true;
@@ -943,8 +947,14 @@
                     Slog.v(TAG,
                             "Creating viewState for " + id + " on " + getActionAsString(action));
                 }
-                viewState = new ViewState(this, id, value, this, ViewState.STATE_INITIAL);
+                boolean isIgnored = isIgnoredLocked(id);
+                viewState = new ViewState(this, id, value, this,
+                        isIgnored ? ViewState.STATE_IGNORED : ViewState.STATE_INITIAL);
                 mViewStates.put(id, viewState);
+                if (isIgnored) {
+                    if (sDebug) Slog.d(TAG, "updateLocked(): ignoring view " + id);
+                    return;
+                }
             } else {
                 if (sVerbose) Slog.v(TAG, "Ignored " + getActionAsString(action) + " for " + id);
                 return;
@@ -983,16 +993,11 @@
                 break;
             case ACTION_VIEW_ENTERED:
                 if (shouldStartNewPartitionLocked(id)) {
-                    // TODO(b/37424539): proper implementation
-                    if (mResponseWaitingAuth != null) {
-                        viewState.setState(ViewState.STATE_WAITING_RESPONSE_AUTH);
-                    } else {
-                        if (sDebug) {
-                            Slog.d(TAG, "Starting partition for view id " + viewState.id);
-                        }
-                        viewState.setState(ViewState.STATE_STARTED_PARTITION);
-                        requestNewFillResponseLocked(flags);
+                    if (sDebug) {
+                        Slog.d(TAG, "Starting partition for view id " + viewState.id);
                     }
+                    viewState.setState(ViewState.STATE_STARTED_PARTITION);
+                    requestNewFillResponseLocked(flags);
                 }
 
                 // Remove the UI if the ViewState has changed.
@@ -1015,6 +1020,18 @@
         }
     }
 
+    /**
+     * Checks whether a view should be ignored.
+     */
+    private boolean isIgnoredLocked(AutofillId id) {
+        if (mResponses == null || mResponses.size() == 0) {
+            return false;
+        }
+        // Always check the latest response only
+        final FillResponse response = mResponses.valueAt(mResponses.size() - 1);
+        return ArrayUtils.contains(response.getIgnoredIds(), id);
+    }
+
     @Override
     public void onFillReady(FillResponse response, AutofillId filledId,
             @Nullable AutofillValue value) {
@@ -1149,18 +1166,24 @@
         final SaveInfo saveInfo = response.getSaveInfo();
         if (saveInfo != null) {
             final AutofillId[] requiredIds = saveInfo.getRequiredIds();
-            for (int i = 0; i < requiredIds.length; i++) {
-                final AutofillId id = requiredIds[i];
+            for (AutofillId id : requiredIds) {
                 createOrUpdateViewStateLocked(id, state, null);
             }
             final AutofillId[] optionalIds = saveInfo.getOptionalIds();
             if (optionalIds != null) {
-                for (int i = 0; i < optionalIds.length; i++) {
-                    final AutofillId id = optionalIds[i];
+                for (AutofillId id : optionalIds) {
                     createOrUpdateViewStateLocked(id, state, null);
                 }
             }
         }
+
+        final AutofillId[] authIds = response.getAuthenticationIds();
+        if (authIds != null) {
+            for (AutofillId id : authIds) {
+                createOrUpdateViewStateLocked(id, state, null);
+            }
+        }
+
     }
 
     /**
diff --git a/services/autofill/java/com/android/server/autofill/ViewState.java b/services/autofill/java/com/android/server/autofill/ViewState.java
index 7ca9435..d114e14 100644
--- a/services/autofill/java/com/android/server/autofill/ViewState.java
+++ b/services/autofill/java/com/android/server/autofill/ViewState.java
@@ -17,6 +17,7 @@
 package com.android.server.autofill;
 
 import static com.android.server.autofill.Helper.sDebug;
+import static com.android.server.autofill.Helper.sVerbose;
 
 import android.annotation.Nullable;
 import android.graphics.Rect;
@@ -61,8 +62,8 @@
     public static final int STATE_STARTED_PARTITION = 0x20;
     /** User select a dataset in this view, but service must authenticate first. */
     public static final int STATE_WAITING_DATASET_AUTH = 0x40;
-    // TODO(b/37424539): temporary workaround until partitioning supports auth
-    public static final int STATE_WAITING_RESPONSE_AUTH = 0x80;
+    /** Service does not care about this view. */
+    public static final int STATE_IGNORED = 0x80;
 
     public final AutofillId id;
 
@@ -199,7 +200,16 @@
     void dump(String prefix, PrintWriter pw) {
         pw.print(prefix); pw.print("id:" ); pw.println(this.id);
         pw.print(prefix); pw.print("state:" ); pw.println(getStateAsString());
-        pw.print(prefix); pw.print("has response:" ); pw.println(mResponse != null);
+        pw.print(prefix); pw.print("response:");
+        if (mResponse == null) {
+            pw.println("N/A");
+        } else {
+            if (sVerbose) {
+                pw.println(mResponse);
+            } else {
+                pw.println(mResponse.getRequestId());
+            }
+        }
         pw.print(prefix); pw.print("initialValue:" ); pw.println(mInitialValue);
         pw.print(prefix); pw.print("currentValue:" ); pw.println(mCurrentValue);
         pw.print(prefix); pw.print("autofilledValue:" ); pw.println(mAutofilledValue);
diff --git a/services/autofill/java/com/android/server/autofill/ui/FillUi.java b/services/autofill/java/com/android/server/autofill/ui/FillUi.java
index fa95e03..dd297a6 100644
--- a/services/autofill/java/com/android/server/autofill/ui/FillUi.java
+++ b/services/autofill/java/com/android/server/autofill/ui/FillUi.java
@@ -23,10 +23,12 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentSender;
+import android.graphics.Point;
 import android.graphics.Rect;
 import android.service.autofill.Dataset;
 import android.service.autofill.FillResponse;
 import android.util.Slog;
+import android.util.TypedValue;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
@@ -52,6 +54,8 @@
 
     private static final int VISIBLE_OPTIONS_MAX_COUNT = 3;
 
+    private static final TypedValue sTempTypedValue = new TypedValue();
+
     interface Callback {
         void onResponsePicked(@NonNull FillResponse response);
         void onDatasetPicked(@NonNull Dataset dataset);
@@ -63,9 +67,13 @@
         void startIntentSender(IntentSender intentSender);
     }
 
+    private final @NonNull Point mTempPoint = new Point();
+
     private final @NonNull AutofillWindowPresenter mWindowPresenter =
             new AutofillWindowPresenter();
 
+    private final @NonNull Context mContext;
+
     private final @NonNull AnchoredWindow mWindow;
 
     private final @NonNull Callback mCallback;
@@ -84,6 +92,7 @@
     FillUi(@NonNull Context context, @NonNull FillResponse response,
             @NonNull AutofillId focusedViewId, @NonNull @Nullable String filterText,
             @NonNull Callback callback) {
+        mContext = context;
         mCallback = callback;
 
         final LayoutInflater inflater = LayoutInflater.from(context);
@@ -115,13 +124,18 @@
                 mWindow = null;
                 return;
             }
-            final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
-            final int heightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
-            content.measure(widthMeasureSpec, heightMeasureSpec);
+
+            Point maxSize = mTempPoint;
+            resolveMaxWindowSize(context, maxSize);
+            final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(maxSize.x,
+                    MeasureSpec.AT_MOST);
+            final int heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxSize.y,
+                    MeasureSpec.AT_MOST);
+
+            decor.measure(widthMeasureSpec, heightMeasureSpec);
             decor.setOnClickListener(v -> mCallback.onResponsePicked(response));
-            // TODO(b/37567439): temporary limiting maximum height and minimum width
-            mContentWidth = Math.max(content.getMeasuredWidth(), 1000);
-            mContentHeight = Math.min(content.getMeasuredHeight(), 500);
+            mContentWidth = content.getMeasuredWidth();
+            mContentHeight = content.getMeasuredHeight();
 
             mWindow = new AnchoredWindow(decor);
             mCallback.requestShowFillUi(mContentWidth, mContentHeight, mWindowPresenter);
@@ -245,6 +259,9 @@
             return changed;
         }
 
+        Point maxSize = mTempPoint;
+        resolveMaxWindowSize(mContext, maxSize);
+
         mContentWidth = 0;
         mContentHeight = 0;
 
@@ -254,12 +271,14 @@
         for (int i = 0; i < itemCount; i++) {
             View view = mAdapter.getItem(i).getView();
             view.measure(widthMeasureSpec, heightMeasureSpec);
-            final int newContentWidth = Math.max(mContentWidth, view.getMeasuredWidth());
+            final int clampedMeasuredWidth = Math.min(view.getMeasuredWidth(), maxSize.x);
+            final int newContentWidth = Math.max(mContentWidth, clampedMeasuredWidth);
             if (newContentWidth != mContentWidth) {
                 mContentWidth = newContentWidth;
                 changed = true;
             }
-            final int newContentHeight = mContentHeight + view.getMeasuredHeight();
+            final int clampedMeasuredHeight = Math.min(view.getMeasuredHeight(), maxSize.y);
+            final int newContentHeight = mContentHeight + clampedMeasuredHeight;
             if (newContentHeight != mContentHeight) {
                 mContentHeight = newContentHeight;
                 changed = true;
@@ -274,6 +293,17 @@
         }
     }
 
+    private static void resolveMaxWindowSize(Context context, Point outPoint) {
+        context.getDisplay().getSize(outPoint);
+        TypedValue typedValue = sTempTypedValue;
+        context.getTheme().resolveAttribute(R.attr.autofillDatasetPickerMaxWidth,
+                typedValue, true);
+        outPoint.x = (int) typedValue.getFraction(outPoint.x, outPoint.x);
+        context.getTheme().resolveAttribute(R.attr.autofillDatasetPickerMaxHeight,
+                typedValue, true);
+        outPoint.y = (int) typedValue.getFraction(outPoint.y, outPoint.y);
+    }
+
     private static class ViewItem {
         private final String mValue;
         private final Dataset mDataset;
diff --git a/services/core/java/com/android/server/SystemService.java b/services/core/java/com/android/server/SystemService.java
index c105b12..94397d0 100644
--- a/services/core/java/com/android/server/SystemService.java
+++ b/services/core/java/com/android/server/SystemService.java
@@ -173,6 +173,9 @@
      * state they maintain for running users.  This is called prior to sending the SHUTDOWN
      * broadcast to the user; it is a good place to stop making use of any resources of that
      * user (such as binding to a service running in the user).
+     *
+     * <p>NOTE: This is the last callback where the callee may access the target user's CE storage.
+     *
      * @param userHandle The identifier of the user.
      */
     public void onStopUser(int userHandle) {}
@@ -181,6 +184,10 @@
      * Called when an existing user is stopping, for system services to finalize any per-user
      * state they maintain for running users.  This is called after all application process
      * teardown of the user is complete.
+     *
+     * <p>NOTE: When this callback is called, the CE storage for the target user may not be
+     * accessible already.  Use {@link #onStopUser} instead if you need to access the CE storage.
+     *
      * @param userHandle The identifier of the user.
      */
     public void onCleanupUser(int userHandle) {}
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index 5edf19a..e0fc531 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -2808,7 +2808,7 @@
     void removeUninstalledPackageLocked(String packageName, int userId) {
         ServiceMap smap = mServiceMap.get(userId);
         if (smap != null && smap.mActiveForegroundApps.size() > 0) {
-            for (int i = smap.mActiveForegroundApps.size(); i >= 0; i--) {
+            for (int i = smap.mActiveForegroundApps.size()-1; i >= 0; i--) {
                 ActiveForegroundApp aa = smap.mActiveForegroundApps.valueAt(i);
                 if (aa.mPackageName.equals(packageName)) {
                     smap.mActiveForegroundApps.removeAt(i);
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 61d185f..5d50d70 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -2503,7 +2503,7 @@
                                 tempRect /* outStackBounds */,
                                 otherTaskRect /* outTempTaskBounds */, true /* ignoreVisibility */);
 
-                        resizeStackLocked(i, tempRect,
+                        resizeStackLocked(i, !tempRect.isEmpty() ? tempRect : null,
                                 !otherTaskRect.isEmpty() ? otherTaskRect : tempOtherTaskBounds,
                                 tempOtherTaskInsetBounds, preserveWindows,
                                 true /* allowResizeInDockedMode */, deferResume);
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index e2b838f..e9555f7 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -3251,9 +3251,10 @@
                         if (deviceList.size() > 0) {
                             btDevice = deviceList.get(0);
                             int state = mA2dp.getConnectionState(btDevice);
+                            int intState = (state == BluetoothA2dp.STATE_CONNECTED) ? 1 : 0;
                             int delay = checkSendBecomingNoisyIntent(
-                                                AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
-                                                (state == BluetoothA2dp.STATE_CONNECTED) ? 1 : 0);
+                                    AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, intState,
+                                    AudioSystem.DEVICE_NONE);
                             queueMsgUnderWakeLock(mAudioHandler,
                                     MSG_SET_A2DP_SINK_CONNECTION_STATE,
                                     state,
@@ -3381,9 +3382,8 @@
                     }
                 }
                 if (toRemove != null) {
-                    int delay = checkSendBecomingNoisyIntent(
-                                        AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
-                                        0);
+                    int delay = checkSendBecomingNoisyIntent(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
+                            0, AudioSystem.DEVICE_NONE);
                     for (int i = 0; i < toRemove.size(); i++) {
                         makeA2dpDeviceUnavailableLater(toRemove.valueAt(i), delay);
                     }
@@ -3919,7 +3919,7 @@
                 Slog.i(TAG, "setWiredDeviceConnectionState(" + state + " nm: " + name + " addr:"
                         + address + ")");
             }
-            int delay = checkSendBecomingNoisyIntent(type, state);
+            int delay = checkSendBecomingNoisyIntent(type, state, AudioSystem.DEVICE_NONE);
             queueMsgUnderWakeLock(mAudioHandler,
                     MSG_SET_WIRED_DEVICE_CONNECTION_STATE,
                     0 /* arg1 unused */,
@@ -3931,14 +3931,25 @@
 
     public int setBluetoothA2dpDeviceConnectionState(BluetoothDevice device, int state, int profile)
     {
+        if (mAudioHandler.hasMessages(MSG_SET_A2DP_SINK_CONNECTION_STATE)) {
+            return 0;
+        }
+        return setBluetoothA2dpDeviceConnectionStateInt(
+                device, state, profile, AudioSystem.DEVICE_NONE);
+    }
+
+    public int setBluetoothA2dpDeviceConnectionStateInt(
+            BluetoothDevice device, int state, int profile, int musicDevice)
+    {
         int delay;
         if (profile != BluetoothProfile.A2DP && profile != BluetoothProfile.A2DP_SINK) {
             throw new IllegalArgumentException("invalid profile " + profile);
         }
         synchronized (mConnectedDevices) {
             if (profile == BluetoothProfile.A2DP) {
+                int intState = (state == BluetoothA2dp.STATE_CONNECTED) ? 1 : 0;
                 delay = checkSendBecomingNoisyIntent(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
-                                                (state == BluetoothA2dp.STATE_CONNECTED) ? 1 : 0);
+                        intState, musicDevice);
             } else {
                 delay = 0;
             }
@@ -5162,16 +5173,21 @@
 
         int device = AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP;
         synchronized (mConnectedDevices) {
+            if (mAudioHandler.hasMessages(MSG_SET_A2DP_SINK_CONNECTION_STATE)) {
+                return;
+            }
             final String key = makeDeviceListKey(device, address);
             final DeviceListSpec deviceSpec = mConnectedDevices.get(key);
             if (deviceSpec != null) {
                 // Device is connected
+               int musicDevice = getDeviceForStream(AudioSystem.STREAM_MUSIC);
                if (AudioSystem.handleDeviceConfigChange(device, address,
                         btDevice.getName()) != AudioSystem.AUDIO_STATUS_OK) {
                    // force A2DP device disconnection in case of error so that AudioService state is
                    // consistent with audio policy manager state
-                   setBluetoothA2dpDeviceConnectionState(
-                           btDevice, BluetoothA2dp.STATE_DISCONNECTED, BluetoothProfile.A2DP_SINK);
+                   setBluetoothA2dpDeviceConnectionStateInt(
+                           btDevice, BluetoothA2dp.STATE_DISCONNECTED, BluetoothProfile.A2DP,
+                           musicDevice);
                }
             }
         }
@@ -5242,7 +5258,9 @@
 
     // must be called before removing the device from mConnectedDevices
     // Called synchronized on mConnectedDevices
-    private int checkSendBecomingNoisyIntent(int device, int state) {
+    // musicDevice argument is used when not AudioSystem.DEVICE_NONE instead of querying
+    // from AudioSystem
+    private int checkSendBecomingNoisyIntent(int device, int state, int musicDevice) {
         int delay = 0;
         if ((state == 0) && ((device & mBecomingNoisyIntentDevices) != 0)) {
             int devices = 0;
@@ -5253,8 +5271,13 @@
                     devices |= dev;
                 }
             }
-            int musicDevice = getDeviceForStream(AudioSystem.STREAM_MUSIC);
-            if ((device == musicDevice) && (device == devices)) {
+            if (musicDevice == AudioSystem.DEVICE_NONE) {
+                musicDevice = getDeviceForStream(AudioSystem.STREAM_MUSIC);
+            }
+            // ignore condition on device being actually used for music when in communication
+            // because music routing is altered in this case.
+            if (((device == musicDevice) || isInCommunication()) && (device == devices)) {
+                mAudioHandler.removeMessages(MSG_BROADCAST_AUDIO_BECOMING_NOISY);
                 sendMsg(mAudioHandler,
                         MSG_BROADCAST_AUDIO_BECOMING_NOISY,
                         SENDMSG_REPLACE,
@@ -5338,6 +5361,11 @@
         }
     }
 
+    private static final int DEVICE_OVERRIDE_A2DP_ROUTE_ON_PLUG =
+            AudioSystem.DEVICE_OUT_WIRED_HEADSET | AudioSystem.DEVICE_OUT_WIRED_HEADPHONE |
+            AudioSystem.DEVICE_OUT_LINE |
+            AudioSystem.DEVICE_OUT_ALL_USB;
+
     private void onSetWiredDeviceConnectionState(int device, int state, String address,
             String deviceName, String caller) {
         if (DEBUG_DEVICES) {
@@ -5349,9 +5377,7 @@
         }
 
         synchronized (mConnectedDevices) {
-            if ((state == 0) && ((device == AudioSystem.DEVICE_OUT_WIRED_HEADSET) ||
-                    (device == AudioSystem.DEVICE_OUT_WIRED_HEADPHONE) ||
-                    (device == AudioSystem.DEVICE_OUT_LINE))) {
+            if ((state == 0) && ((device & DEVICE_OVERRIDE_A2DP_ROUTE_ON_PLUG) != 0)) {
                 setBluetoothA2dpOnInt(true);
             }
             boolean isUsb = ((device & ~AudioSystem.DEVICE_OUT_ALL_USB) == 0) ||
@@ -5362,9 +5388,7 @@
                 return;
             }
             if (state != 0) {
-                if ((device == AudioSystem.DEVICE_OUT_WIRED_HEADSET) ||
-                    (device == AudioSystem.DEVICE_OUT_WIRED_HEADPHONE) ||
-                    (device == AudioSystem.DEVICE_OUT_LINE)) {
+                if ((device & DEVICE_OVERRIDE_A2DP_ROUTE_ON_PLUG) != 0) {
                     setBluetoothA2dpOnInt(false);
                 }
                 if ((device & mSafeMediaVolumeDevices) != 0) {
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 8b84205..ed47c3e 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -4217,7 +4217,9 @@
         if (wasPosted) {
             // status bar
             if (r.getNotification().getSmallIcon() != null) {
-                r.isCanceled = true;
+                if (reason != REASON_SNOOZED) {
+                    r.isCanceled = true;
+                }
                 mListeners.notifyRemovedLocked(r.sbn, reason);
                 mHandler.post(new Runnable() {
                     @Override
@@ -4340,9 +4342,11 @@
                         updateLightsLocked();
                     } else {
                         // No notification was found, assume that it is snoozed and cancel it.
-                        final boolean wasSnoozed = mSnoozeHelper.cancel(userId, pkg, tag, id);
-                        if (wasSnoozed) {
-                            savePolicyFile();
+                        if (reason != REASON_SNOOZED) {
+                            final boolean wasSnoozed = mSnoozeHelper.cancel(userId, pkg, tag, id);
+                            if (wasSnoozed) {
+                                savePolicyFile();
+                            }
                         }
                     }
                 }
@@ -4472,7 +4476,7 @@
     void snoozeNotificationInt(String key, long duration, String snoozeCriterionId,
             ManagedServiceInfo listener) {
         String listenerName = listener == null ? null : listener.component.toShortString();
-        if (duration <= 0 && snoozeCriterionId == null) {
+        if (duration <= 0 && snoozeCriterionId == null || key == null) {
             return;
         }
 
diff --git a/services/core/java/com/android/server/notification/SnoozeHelper.java b/services/core/java/com/android/server/notification/SnoozeHelper.java
index 42b4f57..a178a52 100644
--- a/services/core/java/com/android/server/notification/SnoozeHelper.java
+++ b/services/core/java/com/android/server/notification/SnoozeHelper.java
@@ -167,16 +167,10 @@
                 for (Map.Entry<String, NotificationRecord> record : records) {
                     final StatusBarNotification sbn = record.getValue().sbn;
                     if (Objects.equals(sbn.getTag(), tag) && sbn.getId() == id) {
-                        key = record.getKey();
+                        record.getValue().isCanceled = true;
+                        return true;
                     }
                 }
-                if (key != null) {
-                    recordsForPkg.remove(key);
-                    cancelAlarm(userId, pkg, key);
-                    mPackages.remove(key);
-                    mUsers.remove(key);
-                    return true;
-                }
             }
         }
         return false;
@@ -190,7 +184,7 @@
         final int N = userIds.length;
         for (int i = 0; i < N; i++) {
             final ArrayMap<String, ArrayMap<String, NotificationRecord>> snoozedPkgs =
-                    mSnoozedNotifications.remove(userIds[i]);
+                    mSnoozedNotifications.get(userIds[i]);
             if (snoozedPkgs != null) {
                 final int M = snoozedPkgs.size();
                 for (int j = 0; j < M; j++) {
@@ -198,10 +192,7 @@
                     if (records != null) {
                         int P = records.size();
                         for (int k = 0; k < P; k++) {
-                            final String key = records.keyAt(k);
-                            cancelAlarm(userId, snoozedPkgs.keyAt(j), key);
-                            mPackages.remove(key);
-                            mUsers.remove(key);
+                            records.valueAt(k).isCanceled = true;
                         }
                     }
                 }
@@ -215,13 +206,10 @@
         if (mSnoozedNotifications.containsKey(userId)) {
             if (mSnoozedNotifications.get(userId).containsKey(pkg)) {
                 ArrayMap<String, NotificationRecord> records =
-                        mSnoozedNotifications.get(userId).remove(pkg);
+                        mSnoozedNotifications.get(userId).get(pkg);
                 int N = records.size();
                 for (int i = 0; i < N; i++) {
-                    final String key = records.keyAt(i);
-                    cancelAlarm(userId, pkg, key);
-                    mPackages.remove(key);
-                    mUsers.remove(key);
+                    records.valueAt(i).isCanceled = true;
                 }
                 return true;
             }
@@ -229,16 +217,6 @@
         return false;
     }
 
-    private void cancelAlarm(int userId, String pkg, String key) {
-        long identity = Binder.clearCallingIdentity();
-        try {
-            final PendingIntent pi = createPendingIntent(pkg, key, userId);
-            mAm.cancel(pi);
-        } finally {
-            Binder.restoreCallingIdentity(identity);
-        }
-    }
-
     /**
      * Updates the notification record so the most up to date information is shown on re-post.
      */
@@ -252,6 +230,10 @@
         if (pkgRecords == null) {
             return;
         }
+        NotificationRecord existing = pkgRecords.get(record.getKey());
+        if (existing != null && existing.isCanceled) {
+            return;
+        }
         pkgRecords.put(record.getKey(), record);
     }
 
@@ -274,8 +256,10 @@
             return;
         }
         final NotificationRecord record = pkgRecords.remove(key);
+        mPackages.remove(key);
+        mUsers.remove(key);
 
-        if (record != null) {
+        if (record != null && !record.isCanceled) {
             MetricsLogger.action(record.getLogMaker()
                     .setCategory(MetricsProto.MetricsEvent.NOTIFICATION_SNOOZED)
                     .setType(MetricsProto.MetricsEvent.TYPE_OPEN));
@@ -309,10 +293,12 @@
                         mPackages.remove(groupSummaryKey);
                         mUsers.remove(groupSummaryKey);
 
-                        MetricsLogger.action(record.getLogMaker()
-                                .setCategory(MetricsProto.MetricsEvent.NOTIFICATION_SNOOZED)
-                                .setType(MetricsProto.MetricsEvent.TYPE_OPEN));
-                        mCallback.repost(userId, record);
+                        if (record != null && !record.isCanceled) {
+                            MetricsLogger.action(record.getLogMaker()
+                                    .setCategory(MetricsProto.MetricsEvent.NOTIFICATION_SNOOZED)
+                                    .setType(MetricsProto.MetricsEvent.TYPE_OPEN));
+                            mCallback.repost(userId, record);
+                        }
                     }
                 }
             }
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index a56590e..61d83e5 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -4360,8 +4360,7 @@
                     }
 
                     SharedLibraryInfo resLibInfo = new SharedLibraryInfo(libInfo.getName(),
-                            // TODO: Remove cast for lib version once internally we support longs.
-                            (int) libInfo.getVersion(), libInfo.getType(),
+                            libInfo.getVersion(), libInfo.getType(),
                             libInfo.getDeclaringPackage(), getPackagesUsingSharedLibraryLPr(libInfo,
                             flags, userId));
 
@@ -6509,7 +6508,7 @@
                     ephemeralInstaller.filter = new IntentFilter(intent.getAction());
                     ephemeralInstaller.filter.addDataPath(
                             intent.getData().getPath(), PatternMatcher.PATTERN_LITERAL);
-                    ephemeralInstaller.instantAppAvailable = true;
+                    ephemeralInstaller.isInstantAppAvailable = true;
                     result.add(ephemeralInstaller);
                 }
             }
@@ -12611,7 +12610,7 @@
             }
             res.iconResourceId = info.icon;
             res.system = res.activityInfo.applicationInfo.isSystemApp();
-            res.instantAppAvailable = userState.instantApp;
+            res.isInstantAppAvailable = userState.instantApp;
             return res;
         }
 
@@ -17750,8 +17749,7 @@
         for (int i = 0; i < versionCount; i++) {
             SharedLibraryEntry libEntry = versionedLib.valueAt(i);
             if (versionsCallerCanSee != null && versionsCallerCanSee.indexOfKey(
-                    // TODO: Remove cast for lib version once internally we support longs.
-                    (int) libEntry.info.getVersion()) < 0) {
+                    libEntry.info.getVersion()) < 0) {
                 continue;
             }
             // TODO: We will change version code to long, so in the new API it is long
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java
index 7c89e1c..bed8f1a 100644
--- a/services/core/java/com/android/server/pm/ShortcutService.java
+++ b/services/core/java/com/android/server/pm/ShortcutService.java
@@ -555,8 +555,8 @@
         }
 
         @Override
-        public void onCleanupUser(int userHandle) {
-            mService.handleCleanupUser(userHandle);
+        public void onStopUser(int userHandle) {
+            mService.handleStopUser(userHandle);
         }
 
         @Override
@@ -606,9 +606,9 @@
     }
 
     /** lifecycle event */
-    void handleCleanupUser(int userId) {
+    void handleStopUser(int userId) {
         if (DEBUG) {
-            Slog.d(TAG, "handleCleanupUser: user=" + userId);
+            Slog.d(TAG, "handleStopUser: user=" + userId);
         }
         synchronized (mLock) {
             unloadUserLocked(userId);
@@ -3777,7 +3777,7 @@
 
                 Slog.i(TAG, "cmd: handleUnloadUser: user=" + mUserId);
 
-                ShortcutService.this.handleCleanupUser(mUserId);
+                ShortcutService.this.handleStopUser(mUserId);
             }
         }
 
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index 61ed72d..8c3d80f 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -65,6 +65,7 @@
 import android.service.vr.IVrStateCallbacks;
 import android.util.EventLog;
 import android.util.KeyValueListParser;
+import android.util.Log;
 import android.util.PrintWriterPrinter;
 import android.util.Slog;
 import android.util.SparseArray;
@@ -91,6 +92,10 @@
 import com.android.server.lights.Light;
 import com.android.server.lights.LightsManager;
 import com.android.server.power.BatterySaverPolicy.ServiceType;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
 import libcore.util.Objects;
 
 import java.io.FileDescriptor;
@@ -191,6 +196,12 @@
     // System property indicating that the screen should remain off until an explicit user action
     private static final String SYSTEM_PROPERTY_QUIESCENT = "ro.boot.quiescent";
 
+    // Possible reasons for shutting down for use in data/misc/reboot/last_shutdown_reason
+    private static final String REASON_SHUTDOWN = "shutdown";
+    private static final String REASON_REBOOT = "reboot";
+    private static final String REASON_USERREQUESTED = "userrequested";
+    private static final String REASON_THERMAL_SHUTDOWN = "thermal-shutdown";
+
     private static final String TRACE_SCREEN_ON = "Screen turning on";
 
     /** If turning screen on takes more than this long, we show a warning on logcat. */
@@ -204,6 +215,9 @@
     private static final int HALT_MODE_REBOOT = 1;
     private static final int HALT_MODE_REBOOT_SAFE_MODE = 2;
 
+    // File location for last reboot reason
+    private static final String LAST_REBOOT_LOCATION = "/data/misc/reboot/last_reboot_reason";
+
     private final Context mContext;
     private final ServiceThread mHandlerThread;
     private final PowerManagerHandler mHandler;
@@ -4340,6 +4354,25 @@
         }
 
         /**
+         * Gets the reason for the last time the phone had to reboot.
+         *
+         * @return The reason the phone last shut down as an int or
+         * {@link PowerManager.SHUTDOWN_REASON_UNKNOWN} if the file could not be opened.
+         */
+        @Override // Binder call
+        public int getLastShutdownReason() {
+            mContext.enforceCallingOrSelfPermission(
+                    android.Manifest.permission.DEVICE_POWER, null);
+
+            final long ident = Binder.clearCallingIdentity();
+            try {
+                return getLastShutdownReasonInternal(new File(LAST_REBOOT_LOCATION));
+            } finally {
+                Binder.restoreCallingIdentity(ident);
+            }
+        }
+
+        /**
          * Reboots the device.
          *
          * @param confirm If true, shows a reboot confirmation dialog.
@@ -4566,6 +4599,28 @@
         }
     }
 
+    @VisibleForTesting
+    int getLastShutdownReasonInternal(File lastRebootReason) {
+        String line = "";
+        try (BufferedReader bufferedReader = new BufferedReader(new FileReader(lastRebootReason))){
+            line = bufferedReader.readLine();
+        } catch (IOException e) {
+            Slog.e(TAG, "Failed to read last_reboot_reason file", e);
+        }
+        switch (line) {
+            case REASON_SHUTDOWN:
+                return PowerManager.SHUTDOWN_REASON_SHUTDOWN;
+            case REASON_REBOOT:
+                return PowerManager.SHUTDOWN_REASON_REBOOT;
+            case REASON_USERREQUESTED:
+                return PowerManager.SHUTDOWN_REASON_USER_REQUESTED;
+            case REASON_THERMAL_SHUTDOWN:
+                return PowerManager.SHUTDOWN_REASON_THERMAL_SHUTDOWN;
+            default:
+                return PowerManager.SHUTDOWN_REASON_UNKNOWN;
+        }
+    }
+
     private final class LocalService extends PowerManagerInternal {
         @Override
         public void setScreenBrightnessOverrideFromWindowManager(int screenBrightness) {
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 2236b59..a6b95d6 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -1132,7 +1132,10 @@
         // Task is non-null per shouldCropToStackBounds
         final TaskStack stack = w.getTask().mStack;
         stack.getDimBounds(finalClipRect);
-        w.expandForSurfaceInsets(finalClipRect);
+
+        if (StackId.tasksAreFloating(stack.mStackId)) {
+            w.expandForSurfaceInsets(finalClipRect);
+        }
         return true;
     }
 
diff --git a/services/core/jni/com_android_server_SystemServer.cpp b/services/core/jni/com_android_server_SystemServer.cpp
index 4a08ce4..96c2d7e 100644
--- a/services/core/jni/com_android_server_SystemServer.cpp
+++ b/services/core/jni/com_android_server_SystemServer.cpp
@@ -48,7 +48,7 @@
 
     status_t err;
 
-    configureRpcThreadpool(1, false /* callerWillJoin */);
+    configureRpcThreadpool(5, false /* callerWillJoin */);
 
     sp<ISensorManager> sensorService = new SensorManager();
     err = sensorService->registerAsService();
diff --git a/services/tests/notification/src/com/android/server/notification/SnoozeHelperTest.java b/services/tests/notification/src/com/android/server/notification/SnoozeHelperTest.java
index 51ec05c..bc25860 100644
--- a/services/tests/notification/src/com/android/server/notification/SnoozeHelperTest.java
+++ b/services/tests/notification/src/com/android/server/notification/SnoozeHelperTest.java
@@ -107,9 +107,9 @@
                 UserHandle.USER_SYSTEM, r2.sbn.getPackageName(), r2.getKey()));
 
         mSnoozeHelper.cancel(UserHandle.USER_SYSTEM, r.sbn.getPackageName(), "one", 1);
-        // 3 = one for each snooze, above + one for cancel itself.
-        verify(mAm, times(3)).cancel(any(PendingIntent.class));
-        assertFalse(mSnoozeHelper.isSnoozed(
+        // 2 = one for each snooze, above, zero for the cancel.
+        verify(mAm, times(2)).cancel(any(PendingIntent.class));
+        assertTrue(mSnoozeHelper.isSnoozed(
                 UserHandle.USER_SYSTEM, r.sbn.getPackageName(), r.getKey()));
         assertTrue(mSnoozeHelper.isSnoozed(
                 UserHandle.USER_SYSTEM, r2.sbn.getPackageName(), r2.getKey()));
@@ -131,11 +131,11 @@
                 UserHandle.USER_ALL, r3.sbn.getPackageName(), r3.getKey()));
 
         mSnoozeHelper.cancel(UserHandle.USER_SYSTEM, false);
-        // 5 = once for each snooze above (3) + once for each notification canceled (2).
-        verify(mAm, times(5)).cancel(any(PendingIntent.class));
-        assertFalse(mSnoozeHelper.isSnoozed(
+        // 3 = once for each snooze above (3), only.
+        verify(mAm, times(3)).cancel(any(PendingIntent.class));
+        assertTrue(mSnoozeHelper.isSnoozed(
                 UserHandle.USER_SYSTEM, r.sbn.getPackageName(), r.getKey()));
-        assertFalse(mSnoozeHelper.isSnoozed(
+        assertTrue(mSnoozeHelper.isSnoozed(
                 UserHandle.USER_SYSTEM, r2.sbn.getPackageName(), r2.getKey()));
         assertTrue(mSnoozeHelper.isSnoozed(
                 UserHandle.USER_ALL, r3.sbn.getPackageName(), r3.getKey()));
@@ -157,17 +157,47 @@
                 UserHandle.USER_SYSTEM, r3.sbn.getPackageName(), r3.getKey()));
 
         mSnoozeHelper.cancel(UserHandle.USER_SYSTEM, "pkg2");
-        // 4 = once for each snooze above (3) + once for each notification canceled (1).
-        verify(mAm, times(4)).cancel(any(PendingIntent.class));
+        // 3 = once for each snooze above (3), only.
+        verify(mAm, times(3)).cancel(any(PendingIntent.class));
         assertTrue(mSnoozeHelper.isSnoozed(
                 UserHandle.USER_SYSTEM, r.sbn.getPackageName(), r.getKey()));
         assertTrue(mSnoozeHelper.isSnoozed(
                 UserHandle.USER_SYSTEM, r2.sbn.getPackageName(), r2.getKey()));
-        assertFalse(mSnoozeHelper.isSnoozed(
+        assertTrue(mSnoozeHelper.isSnoozed(
                 UserHandle.USER_SYSTEM, r3.sbn.getPackageName(), r3.getKey()));
     }
 
     @Test
+    public void testCancelDoesNotUnsnooze() throws Exception {
+        NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM);
+        mSnoozeHelper.snooze(r, 1000);
+        assertTrue(mSnoozeHelper.isSnoozed(
+                UserHandle.USER_SYSTEM, r.sbn.getPackageName(), r.getKey()));
+
+        mSnoozeHelper.cancel(UserHandle.USER_SYSTEM, r.sbn.getPackageName(), "one", 1);
+
+        assertTrue(mSnoozeHelper.isSnoozed(
+                UserHandle.USER_SYSTEM, r.sbn.getPackageName(), r.getKey()));
+    }
+
+    @Test
+    public void testCancelDoesNotRepost() throws Exception {
+        NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM);
+        NotificationRecord r2 = getNotificationRecord("pkg", 2, "two", UserHandle.SYSTEM);
+        mSnoozeHelper.snooze(r, 1000);
+        mSnoozeHelper.snooze(r2 , 1000);
+        assertTrue(mSnoozeHelper.isSnoozed(
+                UserHandle.USER_SYSTEM, r.sbn.getPackageName(), r.getKey()));
+        assertTrue(mSnoozeHelper.isSnoozed(
+                UserHandle.USER_SYSTEM, r2.sbn.getPackageName(), r2.getKey()));
+
+        mSnoozeHelper.cancel(UserHandle.USER_SYSTEM, r.sbn.getPackageName(), "one", 1);
+
+        mSnoozeHelper.repost(r.getKey(), UserHandle.USER_SYSTEM);
+        verify(mCallback, never()).repost(UserHandle.USER_SYSTEM, r);
+    }
+
+    @Test
     public void testRepost() throws Exception {
         NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM);
         mSnoozeHelper.snooze(r, 1000);
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
index cd39d88..4c7bf4d 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
@@ -3241,7 +3241,7 @@
         assertNull(mService.getShortcutsForTest().get(USER_10).getLastKnownLauncher());
 
         // Try stopping the user
-        mService.handleCleanupUser(USER_10);
+        mService.handleStopUser(USER_10);
 
         // Now it's unloaded.
         assertEquals(1, mService.getShortcutsForTest().size());
@@ -6106,7 +6106,7 @@
             assertEmpty(mManager.getPinnedShortcuts());
         });
         // Send add broadcast, but the user is not running, so should be ignored.
-        mService.handleCleanupUser(USER_10);
+        mService.handleStopUser(USER_10);
         mRunningUsers.put(USER_10, false);
         mUnlockedUsers.put(USER_10, false);
 
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java
index 9880caa..2b40c51 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java
@@ -2091,7 +2091,7 @@
         assertFalse(mService.isUserUnlockedL(USER_10));
 
         // Directly call the stop lifecycle event.  Goes back to the initial state.
-        mService.handleCleanupUser(USER_0);
+        mService.handleStopUser(USER_0);
         assertFalse(mService.isUserUnlockedL(USER_0));
         assertFalse(mService.isUserUnlockedL(USER_10));
     }
diff --git a/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java
index 967b0a4..d12c07a 100644
--- a/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java
@@ -16,10 +16,19 @@
 
 package com.android.server.power;
 
+import android.content.Context;
 import android.hardware.display.DisplayManagerInternal.DisplayPowerRequest;
+import android.os.PowerManager;
 import android.os.PowerSaveState;
 import android.test.AndroidTestCase;
 import android.test.suitebuilder.annotation.SmallTest;
+import android.text.TextUtils;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
@@ -35,11 +44,16 @@
     private static final float PRECISION = 0.001f;
     private static final float BRIGHTNESS_FACTOR = 0.7f;
     private static final boolean BATTERY_SAVER_ENABLED = true;
+    private static final String LAST_REBOOT_REASON = "last_reboot_reason";
 
     private @Mock BatterySaverPolicy mBatterySaverPolicy;
     private PowerManagerService mService;
     private PowerSaveState mPowerSaveState;
     private DisplayPowerRequest mDisplayPowerRequest;
+    private File mTempReason;
+
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
     public void setUp() throws Exception {
         super.setUp();
@@ -54,6 +68,8 @@
                 .thenReturn(mPowerSaveState);
         mDisplayPowerRequest = new DisplayPowerRequest();
         mService = new PowerManagerService(getContext(), mBatterySaverPolicy);
+        temporaryFolder.create();
+        mTempReason = temporaryFolder.newFile(LAST_REBOOT_REASON);
     }
 
     @SmallTest
@@ -63,4 +79,17 @@
         assertThat(mDisplayPowerRequest.screenLowPowerBrightnessFactor)
                 .isWithin(PRECISION).of(BRIGHTNESS_FACTOR);
     }
+
+    @SmallTest
+    public void testGetLastShutdownReasonInternal() {
+        try {
+            FileWriter writer = new FileWriter(mTempReason);
+            writer.append("thermal-shutdown\n");
+            writer.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        int reason = mService.getLastShutdownReasonInternal(mTempReason);
+        assertThat(reason).isEqualTo(PowerManager.SHUTDOWN_REASON_THERMAL_SHUTDOWN);
+    }
 }
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 81f6600..7f616ad 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -342,6 +342,32 @@
     public static final String SUB_DEFAULT_CHANGED_ACTION =
         "android.intent.action.SUB_DEFAULT_CHANGED";
 
+    /**
+     * Broadcast Action: The default subscription has changed.  This has the following
+     * extra values:</p>
+     * The {@link #EXTRA_SUBSCRIPTION_INDEX} extra indicates the current default subscription index
+     */
+    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+    public static final String ACTION_DEFAULT_SUBSCRIPTION_CHANGED
+            = "android.telephony.action.DEFAULT_SUBSCRIPTION_CHANGED";
+
+    /**
+     * Broadcast Action: The default sms subscription has changed.  This has the following
+     * extra values:</p>
+     * {@link #EXTRA_SUBSCRIPTION_INDEX} extra indicates the current default sms
+     * subscription index
+     */
+    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+    public static final String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED
+            = "android.telephony.action.DEFAULT_SMS_SUBSCRIPTION_CHANGED";
+
+    /**
+     * Integer extra used with {@link #ACTION_DEFAULT_SUBSCRIPTION_CHANGED} and
+     * {@link #ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED} to indicate the subscription
+     * which has changed.
+     */
+    public static final String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX";
+
     private final Context mContext;
 
     /**
@@ -1178,7 +1204,7 @@
     public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId, int subId) {
         if (VDBG) logd("putPhoneIdAndSubIdExtra: phoneId=" + phoneId + " subId=" + subId);
         intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
-        intent.putExtra(Intent.EXTRA_SUBSCRIPTION_INDEX, subId);
+        intent.putExtra(EXTRA_SUBSCRIPTION_INDEX, subId);
         intent.putExtra(PhoneConstants.PHONE_KEY, phoneId);
         //FIXME this is using phoneId and slotIndex interchangeably
         //Eventually, this should be removed as it is not the slot id
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index ec9ca1d..1f32766 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
@@ -17,6 +17,7 @@
 package com.android.internal.telephony;
 
 import android.content.Intent;
+import android.telephony.SubscriptionManager;
 
 /**
  * The intents that the telephony services broadcast.
@@ -335,11 +336,11 @@
      * <ul>
      *   <li><em>subscription</em> - A int, the current default subscription.</li>
      * </ul>
-     * @deprecated Use {@link Intent#ACTION_DEFAULT_SUBSCRIPTION_CHANGED}
+     * @deprecated Use {@link SubscriptionManager#ACTION_DEFAULT_SUBSCRIPTION_CHANGED}
      */
     @Deprecated
     public static final String ACTION_DEFAULT_SUBSCRIPTION_CHANGED
-            = Intent.ACTION_DEFAULT_SUBSCRIPTION_CHANGED;
+            = SubscriptionManager.ACTION_DEFAULT_SUBSCRIPTION_CHANGED;
 
     /**
      * Broadcast Action: The default data subscription has changed.  This has the following
@@ -367,11 +368,11 @@
      * <ul>
      *   <li><em>subscription</em> - A int, the current sms default subscription.</li>
      * </ul>
-     * @deprecated Use {@link Intent#ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED}
+     * @deprecated Use {@link SubscriptionManager#ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED}
      */
     @Deprecated
     public static final String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED
-            = Intent.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED;
+            = SubscriptionManager.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED;
 
     /*
      * Broadcast Action: An attempt to set phone radio type and access technology has changed.
diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
index 93677e3..5dd42dd 100644
--- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
+++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
@@ -385,6 +385,23 @@
                     mNM.notify("timeout_min", 7013, n);
                 }
             },
+            new Test("Too many cancels") {
+                public void run()
+                {
+                    mNM.cancelAll();
+                    try {
+                        Thread.sleep(1000);
+                    } catch (InterruptedException e) {
+                        e.printStackTrace();
+                    }
+                    Notification n = new Notification.Builder(NotificationTestList.this, "default")
+                            .setSmallIcon(R.drawable.icon2)
+                            .setContentTitle("Cancel then post")
+                            .setContentText("instead of just updating the existing notification")
+                            .build();
+                    mNM.notify("cancel_madness", 7014, n);
+                }
+            },
         new Test("Off") {
             public void run() {
                 PowerManager pm = (PowerManager) NotificationTestList.this.getSystemService(
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
index 339019d..ed428ec 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
@@ -18,6 +18,7 @@
 
 import android.os.IBinder;
 import android.os.IPowerManager;
+import android.os.PowerManager;
 import android.os.PowerSaveState;
 import android.os.RemoteException;
 import android.os.WorkSource;
@@ -170,4 +171,9 @@
     public boolean isScreenBrightnessBoosted() throws RemoteException {
         return false;
     }
+
+    @Override
+    public int getLastShutdownReason() {
+        return PowerManager.SHUTDOWN_REASON_UNKNOWN;
+    }
 }
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index faae90b..d942d05 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -131,7 +131,7 @@
 
     boolean stopSoftAp();
 
-    WifiConfiguration startLocalOnlyHotspot(in Messenger messenger, in IBinder binder);
+    int startLocalOnlyHotspot(in Messenger messenger, in IBinder binder);
 
     void stopLocalOnlyHotspot();
 
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 8fbf472..e59b74f 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -478,7 +478,6 @@
      */
     public static final int IFACE_IP_MODE_LOCAL_ONLY = 2;
 
-
     /**
      * Broadcast intent action indicating that a connection to the supplicant has
      * been established (and it is now possible
@@ -1850,8 +1849,9 @@
      * Tethering to provide an upstream to another device, LocalOnlyHotspot will not start due to
      * an incompatible mode. The possible error codes include:
      * {@link LocalOnlyHotspotCallback#ERROR_NO_CHANNEL},
-     * {@link LocalOnlyHotspotCallback#ERROR_GENERIC} and
-     * {@link LocalOnlyHotspotCallback#ERROR_INCOMPATIBLE_MODE}.
+     * {@link LocalOnlyHotspotCallback#ERROR_GENERIC},
+     * {@link LocalOnlyHotspotCallback#ERROR_INCOMPATIBLE_MODE} and
+     * {@link LocalOnlyHotspotCallback#ERROR_TETHERING_DISALLOWED}.
      * <p>
      * Internally, requests will be tracked to prevent the hotspot from being torn down while apps
      * are still using it.  The {@link LocalOnlyHotspotReservation} object passed in the  {@link
@@ -1882,8 +1882,6 @@
      * operating status.
      * @param handler Handler to be used for callbacks.  If the caller passes a null Handler, the
      * main thread will be used.
-     *
-     * @hide
      */
     public void startLocalOnlyHotspot(LocalOnlyHotspotCallback callback,
             @Nullable Handler handler) {
@@ -1892,12 +1890,10 @@
             LocalOnlyHotspotCallbackProxy proxy =
                     new LocalOnlyHotspotCallbackProxy(this, looper, callback);
             try {
-                WifiConfiguration config = mService.startLocalOnlyHotspot(
-                        proxy.getMessenger(), new Binder());
-                if (config == null) {
+                int returnCode = mService.startLocalOnlyHotspot(proxy.getMessenger(), new Binder());
+                if (returnCode != LocalOnlyHotspotCallback.REQUEST_REGISTERED) {
                     // Send message to the proxy to make sure we call back on the correct thread
-                    proxy.notifyFailed(
-                            LocalOnlyHotspotCallback.ERROR_INCOMPATIBLE_MODE);
+                    proxy.notifyFailed(returnCode);
                     return;
                 }
                 mLOHSCallbackProxy = proxy;
@@ -2274,8 +2270,6 @@
      * any further callbacks. If the LocalOnlyHotspot is stopped due to a
      * user triggered mode change, applications will be notified via the {@link
      * LocalOnlyHotspotCallback#onStopped()} callback.
-     *
-     * @hide
      */
     public class LocalOnlyHotspotReservation implements AutoCloseable {
 
@@ -2289,7 +2283,7 @@
             mCloseGuard.open("close");
         }
 
-        public WifiConfiguration getConfig() {
+        public WifiConfiguration getWifiConfiguration() {
             return mConfig;
         }
 
@@ -2318,13 +2312,15 @@
 
     /**
      * Callback class for applications to receive updates about the LocalOnlyHotspot status.
-     *
-     * @hide
      */
     public static class LocalOnlyHotspotCallback {
+        /** @hide */
+        public static final int REQUEST_REGISTERED = 0;
+
         public static final int ERROR_NO_CHANNEL = 1;
         public static final int ERROR_GENERIC = 2;
         public static final int ERROR_INCOMPATIBLE_MODE = 3;
+        public static final int ERROR_TETHERING_DISALLOWED = 4;
 
         /** LocalOnlyHotspot start succeeded. */
         public void onStarted(LocalOnlyHotspotReservation reservation) {};
@@ -2345,7 +2341,8 @@
          * {@link WifiManager#startLocalOnlyHotspot(LocalOnlyHotspotCallback, Handler)} again at
          * a later time.
          * <p>
-         * @param reason The reason for failure could be one of: {@link #ERROR_INCOMPATIBLE_MODE},
+         * @param reason The reason for failure could be one of: {@link
+         * #ERROR_TETHERING_DISALLOWED}, {@link #ERROR_INCOMPATIBLE_MODE},
          * {@link #ERROR_NO_CHANNEL}, or {@link #ERROR_GENERIC}.
          */
         public void onFailed(int reason) { };
diff --git a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
index 333a4f7d..1dbaa80 100644
--- a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
+++ b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
@@ -144,12 +144,12 @@
      *
      * Use Long.MIN_VALUE to indicate unset value.
      */
-    private long mSubscriptionCreationTimeInMs = Long.MIN_VALUE;
-    public void setSubscriptionCreationTimeInMs(long subscriptionCreationTimeInMs) {
-        mSubscriptionCreationTimeInMs = subscriptionCreationTimeInMs;
+    private long mSubscriptionCreationTimeInMillis = Long.MIN_VALUE;
+    public void setSubscriptionCreationTimeInMillis(long subscriptionCreationTimeInMillis) {
+        mSubscriptionCreationTimeInMillis = subscriptionCreationTimeInMillis;
     }
-    public long getSubscriptionCreationTimeInMs() {
-        return mSubscriptionCreationTimeInMs;
+    public long getSubscriptionCreationTimeInMillis() {
+        return mSubscriptionCreationTimeInMillis;
     }
 
     /**
@@ -158,12 +158,12 @@
      *
      * Use Long.MIN_VALUE to indicate unset value.
      */
-    private long mSubscriptionExpirationTimeInMs = Long.MIN_VALUE;
-    public void setSubscriptionExpirationTimeInMs(long subscriptionExpirationTimeInMs) {
-        mSubscriptionExpirationTimeInMs = subscriptionExpirationTimeInMs;
+    private long mSubscriptionExpirationTimeInMillis = Long.MIN_VALUE;
+    public void setSubscriptionExpirationTimeInMillis(long subscriptionExpirationTimeInMillis) {
+        mSubscriptionExpirationTimeInMillis = subscriptionExpirationTimeInMillis;
     }
-    public long getSubscriptionExpirationTimeInMs() {
-        return mSubscriptionExpirationTimeInMs;
+    public long getSubscriptionExpirationTimeInMillis() {
+        return mSubscriptionExpirationTimeInMillis;
     }
 
     /**
@@ -197,12 +197,12 @@
      *
      * Use Long.MIN_VALUE to indicate unset value.
      */
-    private long mUsageLimitStartTimeInMs = Long.MIN_VALUE;
-    public void setUsageLimitStartTimeInMs(long usageLimitStartTimeInMs) {
-        mUsageLimitStartTimeInMs = usageLimitStartTimeInMs;
+    private long mUsageLimitStartTimeInMillis = Long.MIN_VALUE;
+    public void setUsageLimitStartTimeInMillis(long usageLimitStartTimeInMillis) {
+        mUsageLimitStartTimeInMillis = usageLimitStartTimeInMillis;
     }
-    public long getUsageLimitStartTimeInMs() {
-        return mUsageLimitStartTimeInMs;
+    public long getUsageLimitStartTimeInMillis() {
+        return mUsageLimitStartTimeInMillis;
     }
 
     /**
@@ -263,11 +263,11 @@
         }
         mUpdateIdentifier = source.mUpdateIdentifier;
         mCredentialPriority = source.mCredentialPriority;
-        mSubscriptionCreationTimeInMs = source.mSubscriptionCreationTimeInMs;
-        mSubscriptionExpirationTimeInMs = source.mSubscriptionExpirationTimeInMs;
+        mSubscriptionCreationTimeInMillis = source.mSubscriptionCreationTimeInMillis;
+        mSubscriptionExpirationTimeInMillis = source.mSubscriptionExpirationTimeInMillis;
         mSubscriptionType = source.mSubscriptionType;
         mUsageLimitDataLimit = source.mUsageLimitDataLimit;
-        mUsageLimitStartTimeInMs = source.mUsageLimitStartTimeInMs;
+        mUsageLimitStartTimeInMillis = source.mUsageLimitStartTimeInMillis;
         mUsageLimitTimeLimitInMinutes = source.mUsageLimitTimeLimitInMinutes;
         mUsageLimitUsageTimePeriodInMinutes = source.mUsageLimitUsageTimePeriodInMinutes;
     }
@@ -286,11 +286,11 @@
         writeTrustRootCerts(dest, mTrustRootCertList);
         dest.writeInt(mUpdateIdentifier);
         dest.writeInt(mCredentialPriority);
-        dest.writeLong(mSubscriptionCreationTimeInMs);
-        dest.writeLong(mSubscriptionExpirationTimeInMs);
+        dest.writeLong(mSubscriptionCreationTimeInMillis);
+        dest.writeLong(mSubscriptionExpirationTimeInMillis);
         dest.writeString(mSubscriptionType);
         dest.writeLong(mUsageLimitUsageTimePeriodInMinutes);
-        dest.writeLong(mUsageLimitStartTimeInMs);
+        dest.writeLong(mUsageLimitStartTimeInMillis);
         dest.writeLong(mUsageLimitDataLimit);
         dest.writeLong(mUsageLimitTimeLimitInMinutes);
     }
@@ -313,11 +313,11 @@
                 && isTrustRootCertListEquals(mTrustRootCertList, that.mTrustRootCertList)
                 && mUpdateIdentifier == that.mUpdateIdentifier
                 && mCredentialPriority == that.mCredentialPriority
-                && mSubscriptionCreationTimeInMs == that.mSubscriptionCreationTimeInMs
-                && mSubscriptionExpirationTimeInMs == that.mSubscriptionExpirationTimeInMs
+                && mSubscriptionCreationTimeInMillis == that.mSubscriptionCreationTimeInMillis
+                && mSubscriptionExpirationTimeInMillis == that.mSubscriptionExpirationTimeInMillis
                 && TextUtils.equals(mSubscriptionType, that.mSubscriptionType)
                 && mUsageLimitUsageTimePeriodInMinutes == that.mUsageLimitUsageTimePeriodInMinutes
-                && mUsageLimitStartTimeInMs == that.mUsageLimitStartTimeInMs
+                && mUsageLimitStartTimeInMillis == that.mUsageLimitStartTimeInMillis
                 && mUsageLimitDataLimit == that.mUsageLimitDataLimit
                 && mUsageLimitTimeLimitInMinutes == that.mUsageLimitTimeLimitInMinutes;
     }
@@ -325,9 +325,9 @@
     @Override
     public int hashCode() {
         return Objects.hash(mHomeSp, mCredential, mPolicy, mSubscriptionUpdate, mTrustRootCertList,
-                mUpdateIdentifier, mCredentialPriority, mSubscriptionCreationTimeInMs,
-                mSubscriptionExpirationTimeInMs, mUsageLimitUsageTimePeriodInMinutes,
-                mUsageLimitStartTimeInMs, mUsageLimitDataLimit, mUsageLimitTimeLimitInMinutes);
+                mUpdateIdentifier, mCredentialPriority, mSubscriptionCreationTimeInMillis,
+                mSubscriptionExpirationTimeInMillis, mUsageLimitUsageTimePeriodInMinutes,
+                mUsageLimitStartTimeInMillis, mUsageLimitDataLimit, mUsageLimitTimeLimitInMinutes);
     }
 
     @Override
@@ -336,13 +336,13 @@
         builder.append("UpdateIdentifier: ").append(mUpdateIdentifier).append("\n");
         builder.append("CredentialPriority: ").append(mCredentialPriority).append("\n");
         builder.append("SubscriptionCreationTime: ").append(
-                mSubscriptionCreationTimeInMs != Long.MIN_VALUE
-                ? new Date(mSubscriptionCreationTimeInMs) : "Not specified").append("\n");
+                mSubscriptionCreationTimeInMillis != Long.MIN_VALUE
+                ? new Date(mSubscriptionCreationTimeInMillis) : "Not specified").append("\n");
         builder.append("SubscriptionExpirationTime: ").append(
-                mSubscriptionExpirationTimeInMs != Long.MIN_VALUE
-                ? new Date(mSubscriptionExpirationTimeInMs) : "Not specified").append("\n");
-        builder.append("UsageLimitStartTime: ").append(mUsageLimitStartTimeInMs != Long.MIN_VALUE
-                ? new Date(mUsageLimitStartTimeInMs) : "Not specified").append("\n");
+                mSubscriptionExpirationTimeInMillis != Long.MIN_VALUE
+                ? new Date(mSubscriptionExpirationTimeInMillis) : "Not specified").append("\n");
+        builder.append("UsageLimitStartTime: ").append(mUsageLimitStartTimeInMillis != Long.MIN_VALUE
+                ? new Date(mUsageLimitStartTimeInMillis) : "Not specified").append("\n");
         builder.append("UsageTimePeriod: ").append(mUsageLimitUsageTimePeriodInMinutes)
                 .append("\n");
         builder.append("UsageLimitDataLimit: ").append(mUsageLimitDataLimit).append("\n");
@@ -433,11 +433,11 @@
                 config.setTrustRootCertList(readTrustRootCerts(in));
                 config.setUpdateIdentifier(in.readInt());
                 config.setCredentialPriority(in.readInt());
-                config.setSubscriptionCreationTimeInMs(in.readLong());
-                config.setSubscriptionExpirationTimeInMs(in.readLong());
+                config.setSubscriptionCreationTimeInMillis(in.readLong());
+                config.setSubscriptionExpirationTimeInMillis(in.readLong());
                 config.setSubscriptionType(in.readString());
                 config.setUsageLimitUsageTimePeriodInMinutes(in.readLong());
-                config.setUsageLimitStartTimeInMs(in.readLong());
+                config.setUsageLimitStartTimeInMillis(in.readLong());
                 config.setUsageLimitDataLimit(in.readLong());
                 config.setUsageLimitTimeLimitInMinutes(in.readLong());
                 return config;
diff --git a/wifi/java/android/net/wifi/hotspot2/omadm/PpsMoParser.java b/wifi/java/android/net/wifi/hotspot2/omadm/PpsMoParser.java
index 5dc5d13..f6183fa 100644
--- a/wifi/java/android/net/wifi/hotspot2/omadm/PpsMoParser.java
+++ b/wifi/java/android/net/wifi/hotspot2/omadm/PpsMoParser.java
@@ -903,10 +903,10 @@
         for (PPSNode child: node.getChildren()) {
             switch (child.getName()) {
                 case NODE_CREATION_DATE:
-                    credential.setCreationTimeInMs(parseDate(getPpsNodeValue(child)));
+                    credential.setCreationTimeInMillis(parseDate(getPpsNodeValue(child)));
                     break;
                 case NODE_EXPIRATION_DATE:
-                    credential.setExpirationTimeInMs(parseDate(getPpsNodeValue(child)));
+                    credential.setExpirationTimeInMillis(parseDate(getPpsNodeValue(child)));
                     break;
                 case NODE_USERNAME_PASSWORD:
                     credential.setUserCredential(parseUserCredential(child));
@@ -1517,10 +1517,10 @@
         for (PPSNode child : node.getChildren()) {
             switch (child.getName()) {
                 case NODE_CREATION_DATE:
-                    config.setSubscriptionCreationTimeInMs(parseDate(getPpsNodeValue(child)));
+                    config.setSubscriptionCreationTimeInMillis(parseDate(getPpsNodeValue(child)));
                     break;
                 case NODE_EXPIRATION_DATE:
-                    config.setSubscriptionExpirationTimeInMs(parseDate(getPpsNodeValue(child)));
+                    config.setSubscriptionExpirationTimeInMillis(parseDate(getPpsNodeValue(child)));
                     break;
                 case NODE_TYPE_OF_SUBSCRIPTION:
                     config.setSubscriptionType(getPpsNodeValue(child));
@@ -1555,7 +1555,7 @@
                     config.setUsageLimitDataLimit(parseLong(getPpsNodeValue(child), 10));
                     break;
                 case NODE_START_DATE:
-                    config.setUsageLimitStartTimeInMs(parseDate(getPpsNodeValue(child)));
+                    config.setUsageLimitStartTimeInMillis(parseDate(getPpsNodeValue(child)));
                     break;
                 case NODE_TIME_LIMIT:
                     config.setUsageLimitTimeLimitInMinutes(parseLong(getPpsNodeValue(child), 10));
diff --git a/wifi/java/android/net/wifi/hotspot2/pps/Credential.java b/wifi/java/android/net/wifi/hotspot2/pps/Credential.java
index 67fa1bb..f89efa6 100644
--- a/wifi/java/android/net/wifi/hotspot2/pps/Credential.java
+++ b/wifi/java/android/net/wifi/hotspot2/pps/Credential.java
@@ -58,12 +58,12 @@
      * of milliseconds since January 1, 1970, 00:00:00 GMT.
      * Using Long.MIN_VALUE to indicate unset value.
      */
-    private long mCreationTimeInMs = Long.MIN_VALUE;
-    public void setCreationTimeInMs(long creationTimeInMs) {
-        mCreationTimeInMs = creationTimeInMs;
+    private long mCreationTimeInMillis = Long.MIN_VALUE;
+    public void setCreationTimeInMillis(long creationTimeInMillis) {
+        mCreationTimeInMillis = creationTimeInMillis;
     }
-    public long getCreationTimeInMs() {
-        return mCreationTimeInMs;
+    public long getCreationTimeInMillis() {
+        return mCreationTimeInMillis;
     }
 
     /**
@@ -71,12 +71,12 @@
      * of milliseconds since January 1, 1970, 00:00:00 GMT.
     * Using Long.MIN_VALUE to indicate unset value.
      */
-    private long mExpirationTimeInMs = Long.MIN_VALUE;
-    public void setExpirationTimeInMs(long expirationTimeInMs) {
-        mExpirationTimeInMs = expirationTimeInMs;
+    private long mExpirationTimeInMillis = Long.MIN_VALUE;
+    public void setExpirationTimeInMillis(long expirationTimeInMillis) {
+        mExpirationTimeInMillis = expirationTimeInMillis;
     }
-    public long getExpirationTimeInMs() {
-        return mExpirationTimeInMs;
+    public long getExpirationTimeInMillis() {
+        return mExpirationTimeInMillis;
     }
 
     /**
@@ -720,8 +720,8 @@
      */
     public Credential(Credential source) {
         if (source != null) {
-            mCreationTimeInMs = source.mCreationTimeInMs;
-            mExpirationTimeInMs = source.mExpirationTimeInMs;
+            mCreationTimeInMillis = source.mCreationTimeInMillis;
+            mExpirationTimeInMillis = source.mExpirationTimeInMillis;
             mRealm = source.mRealm;
             mCheckAaaServerCertStatus = source.mCheckAaaServerCertStatus;
             if (source.mUserCredential != null) {
@@ -749,8 +749,8 @@
 
     @Override
     public void writeToParcel(Parcel dest, int flags) {
-        dest.writeLong(mCreationTimeInMs);
-        dest.writeLong(mExpirationTimeInMs);
+        dest.writeLong(mCreationTimeInMillis);
+        dest.writeLong(mExpirationTimeInMillis);
         dest.writeString(mRealm);
         dest.writeInt(mCheckAaaServerCertStatus ? 1 : 0);
         dest.writeParcelable(mUserCredential, flags);
@@ -772,8 +772,8 @@
 
         Credential that = (Credential) thatObject;
         return TextUtils.equals(mRealm, that.mRealm)
-                && mCreationTimeInMs == that.mCreationTimeInMs
-                && mExpirationTimeInMs == that.mExpirationTimeInMs
+                && mCreationTimeInMillis == that.mCreationTimeInMillis
+                && mExpirationTimeInMillis == that.mExpirationTimeInMillis
                 && mCheckAaaServerCertStatus == that.mCheckAaaServerCertStatus
                 && (mUserCredential == null ? that.mUserCredential == null
                     : mUserCredential.equals(that.mUserCredential))
@@ -788,7 +788,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(mRealm, mCreationTimeInMs, mExpirationTimeInMs,
+        return Objects.hash(mRealm, mCreationTimeInMillis, mExpirationTimeInMillis,
                 mCheckAaaServerCertStatus, mUserCredential, mCertCredential, mSimCredential,
                 mCaCertificate, mClientCertificateChain, mClientPrivateKey);
     }
@@ -797,10 +797,10 @@
     public String toString() {
         StringBuilder builder = new StringBuilder();
         builder.append("Realm: ").append(mRealm).append("\n");
-        builder.append("CreationTime: ").append(mCreationTimeInMs != Long.MIN_VALUE
-                ? new Date(mCreationTimeInMs) : "Not specified").append("\n");
-        builder.append("ExpirationTime: ").append(mExpirationTimeInMs != Long.MIN_VALUE
-                ? new Date(mExpirationTimeInMs) : "Not specified").append("\n");
+        builder.append("CreationTime: ").append(mCreationTimeInMillis != Long.MIN_VALUE
+                ? new Date(mCreationTimeInMillis) : "Not specified").append("\n");
+        builder.append("ExpirationTime: ").append(mExpirationTimeInMillis != Long.MIN_VALUE
+                ? new Date(mExpirationTimeInMillis) : "Not specified").append("\n");
         builder.append("CheckAAAServerStatus: ").append(mCheckAaaServerCertStatus).append("\n");
         if (mUserCredential != null) {
             builder.append("UserCredential Begin ---\n");
@@ -863,8 +863,8 @@
             @Override
             public Credential createFromParcel(Parcel in) {
                 Credential credential = new Credential();
-                credential.setCreationTimeInMs(in.readLong());
-                credential.setExpirationTimeInMs(in.readLong());
+                credential.setCreationTimeInMillis(in.readLong());
+                credential.setExpirationTimeInMillis(in.readLong());
                 credential.setRealm(in.readString());
                 credential.setCheckAaaServerCertStatus(in.readInt() != 0);
                 credential.setUserCredential(in.readParcelable(null));
diff --git a/wifi/tests/src/android/net/wifi/WifiManagerTest.java b/wifi/tests/src/android/net/wifi/WifiManagerTest.java
index 3c0fc6e..03ef319 100644
--- a/wifi/tests/src/android/net/wifi/WifiManagerTest.java
+++ b/wifi/tests/src/android/net/wifi/WifiManagerTest.java
@@ -22,6 +22,7 @@
 import static android.net.wifi.WifiManager.LocalOnlyHotspotCallback.ERROR_GENERIC;
 import static android.net.wifi.WifiManager.LocalOnlyHotspotCallback.ERROR_INCOMPATIBLE_MODE;
 import static android.net.wifi.WifiManager.LocalOnlyHotspotCallback.ERROR_NO_CHANNEL;
+import static android.net.wifi.WifiManager.LocalOnlyHotspotCallback.REQUEST_REGISTERED;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -125,12 +126,12 @@
     public void testCreationAndCloseOfLocalOnlyHotspotReservation() throws Exception {
         TestLocalOnlyHotspotCallback callback = new TestLocalOnlyHotspotCallback();
         when(mWifiService.startLocalOnlyHotspot(any(Messenger.class), any(IBinder.class)))
-                            .thenReturn(mApConfig);
+                            .thenReturn(REQUEST_REGISTERED);
         mWifiManager.startLocalOnlyHotspot(callback, mHandler);
 
         callback.onStarted(mWifiManager.new LocalOnlyHotspotReservation(mApConfig));
 
-        assertEquals(mApConfig, callback.mRes.getConfig());
+        assertEquals(mApConfig, callback.mRes.getWifiConfiguration());
         callback.mRes.close();
         verify(mWifiService).stopLocalOnlyHotspot();
     }
@@ -143,13 +144,13 @@
             throws Exception {
         TestLocalOnlyHotspotCallback callback = new TestLocalOnlyHotspotCallback();
         when(mWifiService.startLocalOnlyHotspot(any(Messenger.class), any(IBinder.class)))
-                .thenReturn(mApConfig);
+                .thenReturn(REQUEST_REGISTERED);
         mWifiManager.startLocalOnlyHotspot(callback, mHandler);
 
         callback.onStarted(mWifiManager.new LocalOnlyHotspotReservation(mApConfig));
 
         try (WifiManager.LocalOnlyHotspotReservation res = callback.mRes) {
-            assertEquals(mApConfig, res.getConfig());
+            assertEquals(mApConfig, res.getWifiConfiguration());
         }
 
         verify(mWifiService).stopLocalOnlyHotspot();
@@ -337,7 +338,7 @@
         // record thread from looper.getThread and check ids.
         TestLocalOnlyHotspotCallback callback = new TestLocalOnlyHotspotCallback();
         when(mWifiService.startLocalOnlyHotspot(any(Messenger.class), any(IBinder.class)))
-                .thenReturn(null);
+                .thenReturn(ERROR_INCOMPATIBLE_MODE);
         mWifiManager.startLocalOnlyHotspot(callback, mHandler);
         mLooper.dispatchAll();
         assertEquals(ERROR_INCOMPATIBLE_MODE, callback.mFailureReason);
@@ -355,7 +356,7 @@
         when(mContext.getMainLooper()).thenReturn(altLooper.getLooper());
         TestLocalOnlyHotspotCallback callback = new TestLocalOnlyHotspotCallback();
         when(mWifiService.startLocalOnlyHotspot(any(Messenger.class), any(IBinder.class)))
-                .thenReturn(null);
+                .thenReturn(ERROR_INCOMPATIBLE_MODE);
         mWifiManager.startLocalOnlyHotspot(callback, null);
         altLooper.dispatchAll();
         assertEquals(ERROR_INCOMPATIBLE_MODE, callback.mFailureReason);
@@ -372,7 +373,7 @@
         TestLooper callbackLooper = new TestLooper();
         Handler callbackHandler = new Handler(callbackLooper.getLooper());
         when(mWifiService.startLocalOnlyHotspot(mMessengerCaptor.capture(),
-                  any(IBinder.class))).thenReturn(mApConfig);
+                  any(IBinder.class))).thenReturn(REQUEST_REGISTERED);
         mWifiManager.startLocalOnlyHotspot(callback, callbackHandler);
         callbackLooper.dispatchAll();
         mLooper.dispatchAll();
@@ -386,7 +387,7 @@
         mLooper.dispatchAll();
         callbackLooper.dispatchAll();
         assertTrue(callback.mOnStartedCalled);
-        assertEquals(mApConfig, callback.mRes.getConfig());
+        assertEquals(mApConfig, callback.mRes.getWifiConfiguration());
     }
 
     /**
@@ -399,7 +400,7 @@
         TestLooper callbackLooper = new TestLooper();
         Handler callbackHandler = new Handler(callbackLooper.getLooper());
         when(mWifiService.startLocalOnlyHotspot(mMessengerCaptor.capture(),
-                  any(IBinder.class))).thenReturn(mApConfig);
+                  any(IBinder.class))).thenReturn(REQUEST_REGISTERED);
         mWifiManager.startLocalOnlyHotspot(callback, callbackHandler);
         callbackLooper.dispatchAll();
         mLooper.dispatchAll();
@@ -424,7 +425,7 @@
         TestLooper callbackLooper = new TestLooper();
         Handler callbackHandler = new Handler(callbackLooper.getLooper());
         when(mWifiService.startLocalOnlyHotspot(mMessengerCaptor.capture(),
-                  any(IBinder.class))).thenReturn(mApConfig);
+                  any(IBinder.class))).thenReturn(REQUEST_REGISTERED);
         mWifiManager.startLocalOnlyHotspot(callback, callbackHandler);
         callbackLooper.dispatchAll();
         mLooper.dispatchAll();
@@ -447,7 +448,7 @@
         TestLooper callbackLooper = new TestLooper();
         Handler callbackHandler = new Handler(callbackLooper.getLooper());
         when(mWifiService.startLocalOnlyHotspot(mMessengerCaptor.capture(),
-                  any(IBinder.class))).thenReturn(mApConfig);
+                  any(IBinder.class))).thenReturn(REQUEST_REGISTERED);
         mWifiManager.startLocalOnlyHotspot(callback, callbackHandler);
         callbackLooper.dispatchAll();
         mLooper.dispatchAll();
@@ -470,7 +471,7 @@
     public void testLocalOnlyHotspotCallbackFullOnNullConfig() throws Exception {
         TestLocalOnlyHotspotCallback callback = new TestLocalOnlyHotspotCallback();
         when(mWifiService.startLocalOnlyHotspot(any(Messenger.class), any(IBinder.class)))
-                .thenReturn(null);
+                .thenReturn(ERROR_INCOMPATIBLE_MODE);
         mWifiManager.startLocalOnlyHotspot(callback, mHandler);
         mLooper.dispatchAll();
         assertEquals(ERROR_INCOMPATIBLE_MODE, callback.mFailureReason);
@@ -508,7 +509,7 @@
     public void testLocalOnlyHotspotCallbackFullOnNoChannelError() throws Exception {
         TestLocalOnlyHotspotCallback callback = new TestLocalOnlyHotspotCallback();
         when(mWifiService.startLocalOnlyHotspot(any(Messenger.class), any(IBinder.class)))
-                .thenReturn(mApConfig);
+                .thenReturn(REQUEST_REGISTERED);
         mWifiManager.startLocalOnlyHotspot(callback, mHandler);
         mLooper.dispatchAll();
         //assertEquals(ERROR_NO_CHANNEL, callback.mFailureReason);
@@ -524,7 +525,7 @@
     public void testCancelLocalOnlyHotspotRequestCallsStopOnWifiService() throws Exception {
         TestLocalOnlyHotspotCallback callback = new TestLocalOnlyHotspotCallback();
         when(mWifiService.startLocalOnlyHotspot(any(Messenger.class), any(IBinder.class)))
-                .thenReturn(mApConfig);
+                .thenReturn(REQUEST_REGISTERED);
         mWifiManager.startLocalOnlyHotspot(callback, mHandler);
         mWifiManager.cancelLocalOnlyHotspotRequest();
         verify(mWifiService).stopLocalOnlyHotspot();
@@ -546,7 +547,7 @@
     public void testCallbackAfterLocalOnlyHotspotWasCancelled() throws Exception {
         TestLocalOnlyHotspotCallback callback = new TestLocalOnlyHotspotCallback();
         when(mWifiService.startLocalOnlyHotspot(any(Messenger.class), any(IBinder.class)))
-                .thenReturn(mApConfig);
+                .thenReturn(REQUEST_REGISTERED);
         mWifiManager.startLocalOnlyHotspot(callback, mHandler);
         mWifiManager.cancelLocalOnlyHotspotRequest();
         verify(mWifiService).stopLocalOnlyHotspot();
@@ -565,7 +566,7 @@
     public void testCancelAfterLocalOnlyHotspotCallbackTriggered() throws Exception {
         TestLocalOnlyHotspotCallback callback = new TestLocalOnlyHotspotCallback();
         when(mWifiService.startLocalOnlyHotspot(any(Messenger.class), any(IBinder.class)))
-                .thenReturn(null);
+                .thenReturn(ERROR_INCOMPATIBLE_MODE);
         mWifiManager.startLocalOnlyHotspot(callback, mHandler);
         mLooper.dispatchAll();
         assertEquals(ERROR_INCOMPATIBLE_MODE, callback.mFailureReason);
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java b/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
index 7df4fcf..afcf3e3 100644
--- a/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
+++ b/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
@@ -158,11 +158,11 @@
         config.setTrustRootCertList(trustRootCertList);
         config.setUpdateIdentifier(1);
         config.setCredentialPriority(120);
-        config.setSubscriptionCreationTimeInMs(231200);
-        config.setSubscriptionExpirationTimeInMs(2134232);
+        config.setSubscriptionCreationTimeInMillis(231200);
+        config.setSubscriptionExpirationTimeInMillis(2134232);
         config.setSubscriptionType("Gold");
         config.setUsageLimitUsageTimePeriodInMinutes(3600);
-        config.setUsageLimitStartTimeInMs(124214213);
+        config.setUsageLimitStartTimeInMillis(124214213);
         config.setUsageLimitDataLimit(14121);
         config.setUsageLimitTimeLimitInMinutes(78912);
         return config;
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/omadm/PpsMoParserTest.java b/wifi/tests/src/android/net/wifi/hotspot2/omadm/PpsMoParserTest.java
index 7cd72f0..afa9fd6 100644
--- a/wifi/tests/src/android/net/wifi/hotspot2/omadm/PpsMoParserTest.java
+++ b/wifi/tests/src/android/net/wifi/hotspot2/omadm/PpsMoParserTest.java
@@ -113,11 +113,11 @@
         config.setSubscriptionUpdate(subscriptionUpdate);
 
         // Subscription parameters.
-        config.setSubscriptionCreationTimeInMs(format.parse("2016-02-01T10:00:00Z").getTime());
-        config.setSubscriptionExpirationTimeInMs(format.parse("2016-03-01T10:00:00Z").getTime());
+        config.setSubscriptionCreationTimeInMillis(format.parse("2016-02-01T10:00:00Z").getTime());
+        config.setSubscriptionExpirationTimeInMillis(format.parse("2016-03-01T10:00:00Z").getTime());
         config.setSubscriptionType("Gold");
         config.setUsageLimitDataLimit(921890);
-        config.setUsageLimitStartTimeInMs(format.parse("2016-12-01T10:00:00Z").getTime());
+        config.setUsageLimitStartTimeInMillis(format.parse("2016-12-01T10:00:00Z").getTime());
         config.setUsageLimitTimeLimitInMinutes(120);
         config.setUsageLimitUsageTimePeriodInMinutes(99910);
 
@@ -138,8 +138,8 @@
 
         // Credential configuration.
         Credential credential = new Credential();
-        credential.setCreationTimeInMs(format.parse("2016-01-01T10:00:00Z").getTime());
-        credential.setExpirationTimeInMs(format.parse("2016-02-01T10:00:00Z").getTime());
+        credential.setCreationTimeInMillis(format.parse("2016-01-01T10:00:00Z").getTime());
+        credential.setExpirationTimeInMillis(format.parse("2016-02-01T10:00:00Z").getTime());
         credential.setRealm("shaken.stirred.com");
         credential.setCheckAaaServerCertStatus(true);
         Credential.UserCredential userCredential = new Credential.UserCredential();
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/pps/CredentialTest.java b/wifi/tests/src/android/net/wifi/hotspot2/pps/CredentialTest.java
index c7ade00..9bfc010 100644
--- a/wifi/tests/src/android/net/wifi/hotspot2/pps/CredentialTest.java
+++ b/wifi/tests/src/android/net/wifi/hotspot2/pps/CredentialTest.java
@@ -56,8 +56,8 @@
                                                X509Certificate[] clientCertificateChain,
                                                PrivateKey clientPrivateKey) {
         Credential cred = new Credential();
-        cred.setCreationTimeInMs(123455L);
-        cred.setExpirationTimeInMs(2310093L);
+        cred.setCreationTimeInMillis(123455L);
+        cred.setExpirationTimeInMillis(2310093L);
         cred.setRealm("realm");
         cred.setCheckAaaServerCertStatus(true);
         cred.setUserCredential(userCred);
@@ -440,4 +440,4 @@
         Credential copyCred = new Credential(sourceCred);
         assertTrue(copyCred.equals(sourceCred));
     }
-}
\ No newline at end of file
+}